Skip to content

Latest commit

 

History

History
44 lines (42 loc) · 4.29 KB

docs.md

File metadata and controls

44 lines (42 loc) · 4.29 KB

Lambdish Phunctional Docs

✨ Available functions

  • all: Check if all the values of the collection satisfies the function
  • any: Check if any value of the collection satisfies the function
  • apply: Call a function with the desired arguments (a clean way to call closures stored in class attributes)
  • assoc: Associate a value to an array
  • butlast: Returns all the elements of a collection except the last preserving the keys
  • complement: Returns another function that takes the same arguments and has the opposite truth value.
  • compose: Combine multiple function calls in one function
  • constant: It wraps a value into a Closure, which return the same value whenever is called
  • dissoc: Dissociate a value of a key in a collection
  • do_if: Returns a callable that will call the given function if the result of applying the callable arguments to the predicates is true for all of them
  • each: Apply a function over all the items of a collection
  • filter: Discriminate the items of a collection for which function is false
  • filter_fresh: Similar to filter, but returns a collection that starts at 0
  • filter_null: Discriminate the items of a collection for which value is null
  • first: Returns the first element of a collection
  • flat_map: Returns an array containing the results of applying a given function to the items of a collection and flattening the results
  • flatten: Returns a flat collection from a multidimensional collection
  • get: Returns the value of an item in a collection or a default value in the case it does not exists
  • get_each: Returns an array with the values or a default value in the case it does not exist of each item in a collection
  • get_in: Returns the value in a nested associative structure or a default value in the case it does not exists
  • group_by: Returns an array with the items grouped by the results of applying a function to each item
  • key: Returns the key of an item value in a collection or a default value in the case it does not exists
  • identity: Returns the same value that is passed as argument
  • instance_of: Returns a checker that validated if an element is an instance of a class
  • last: Returns the last element of a collection
  • map: Apply a function over all the items of a collection and returns an array with the results
  • memoize: Returns a memoized version of a referentially transparent function
  • not: Return the opposite of the function call
  • partial: Fix a number of arguments to a function producing another one with an smaller arity
  • partition: Partition an array into arrays with size elements preserving its keys. The last portion may contain less than size elements.
  • pipe: Takes a set of functions and returns a new one that is the composition of all of them
  • reduce: Returns an accumulated value of iteratively reduce the collection using a function
  • reindex: Returns a new collection with the keys reindexed by a function.
  • repeat: Returns an array with the values of a function executed a certain amount of times
  • rest: Returns all the the elements of a collection except the first preserving the keys
  • reverse: Returns a reversed collection preserving its keys
  • search: Search a value over a collection. Return the first occurrence if found, null if not
  • sort: Sorts a collection using a sorting function
  • some: Check if any value of the collection satisfies the function
  • to_array: Transform a possible iterator to an array