Function source

Methods

by(relation, compare) → {Function} <constructor> source

A utility for creating a comparator function for a particular aspect of a figurative class of objects.

Parameters:
Name Type Description
relation Function

A function that accepts a value and returns a corresponding value to use as a representative when sorting that object.

compare Function

an alternate comparator for comparing the represented values. The default is Object.compare, which does a deep, type-sensitive, polymorphic comparison.

Returns: Function

a comparator that has been annotated with by and compare properties so Array#sorted can perform a transform that reduces the need to call by on each sorted object to just once.

identity(any) → {Any} <constructor> source

A utility to reduce unnecessary allocations of function (x) {return x} in its many colorful but ultimately wasteful parameter name variations.

Parameters:
Name Type Description
any Any

value

Returns: Any

that value

noop() <constructor> source

A utility to reduce unnecessary allocations of function () {} in its many colorful variations. It does nothing and thus makes a suitable default in some circumstances.

Generated from v0.14.14

Need help?

Can't find what you are looking for? Please contact us, we're more than happy to help answer your questions.