conductor
Why I'm building conductorGitHub
v1.5.0
v1.5.0
  • Introduction
  • Overview
    • Introduction
    • Core concepts
  • API reference
    • always
    • append
    • apply
    • arity
    • branch
    • capitalize
    • compose
    • concat
    • curry
    • curryN
    • delay
    • dump
    • entries
    • equals
    • equalsBy
    • factory
    • filter
    • findIndex
    • flatten
    • flip
    • forEach
    • get
    • head
    • ifElse
    • identity
    • into
    • isPromise
    • iterate
    • join
    • keys
    • map
    • merge
    • mergeBy
    • next
    • not
    • pluck
    • prepend
    • random
    • reduce
    • replace
    • slice
    • some
    • split
    • take
    • then
    • toLowerCase
    • transduce
    • transformers
      • transformers/filter
      • transformers/map
    • type
    • upsert
    • values
  • Guides
    • example use cases
    • checkGuards
Powered by GitBook
On this page
  • description
  • example
  1. API reference

arity

arity :: (Number length, Function fn) => Function fn

description

Returns a new function whose arity will be the first argument you provide to arity and which will return the same result as the provided function. A good use case is when you want to limit how many arguments will passed to your function, if you do not control the context in which it is called.

example

import { arity } from 'conductor'

const words = ['hello', 'world']

words.forEach(console.log)
// 'hello' 0 ['hello', 'world']
// 'world' 1 ['hello', 'world']

words.forEach(arity(1, console.log))
// 'hello'
// 'world'
PreviousapplyNextbranch

Last updated 7 years ago