Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
chain-able-deps / dist / loop / sort / comparator.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Makes a comparator function out of a function that reports whether the first
 * element is less than the second.
 *
 * @since 5.0.0-beta.5
 * @memberOf sort
 *
 * @param {Function} predicate A predicate function of arity two which will return `true` if the first argument
 * is less than the second, `false` otherwise
 * @return {Function} A Function :: a -> b -> Int that returns `-1` if a < b, `1` if b < a, otherwise `0`
 *
 * @func
 * @fork v0.1.0
 * @category Function
 * @sig (a, b -> Boolean) -> (a, b -> Number)
 *
 * @example
 *
 *      var byAge = R.comparator((a, b) => a.age < b.age);
 *      var people = [
 *        // ...
 *      ];
 *      var peopleByIncreasingAge = R.sort(byAge, people);
 */
function comparator(predicate) {
    return function (a, b) { return (predicate(a, b) ? -1 : predicate(b, a) ? 1 : 0); };
}
exports.default = comparator;
//# sourceMappingURL=comparator.js.map