swc/bundler/tests/.cache/deno/8ac066d3f0ad434161827a16a20b19da6d22082b.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

38 lines
1.1 KiB
TypeScript

// Loaded from https://deno.land/x/ramda@v0.27.2/source/ascend.js
import _curry3 from './internal/_curry3.js';
/**
* Makes an ascending comparator function out of a function that returns a value
* that can be compared with `<` and `>`.
*
* @func
* @memberOf R
* @since v0.23.0
* @category Function
* @sig Ord b => (a -> b) -> a -> a -> Number
* @param {Function} fn A function of arity one that returns a value that can be compared
* @param {*} a The first item to be compared.
* @param {*} b The second item to be compared.
* @return {Number} `-1` if fn(a) < fn(b), `1` if fn(b) < fn(a), otherwise `0`
* @see R.descend
* @example
*
* const byAge = R.ascend(R.prop('age'));
* const people = [
* { name: 'Emma', age: 70 },
* { name: 'Peter', age: 78 },
* { name: 'Mikhail', age: 62 },
* ];
* const peopleByYoungestFirst = R.sort(byAge, people);
* //=> [{ name: 'Mikhail', age: 62 },{ name: 'Emma', age: 70 }, { name: 'Peter', age: 78 }]
*/
var ascend = _curry3(function ascend(fn, a, b) {
var aa = fn(a);
var bb = fn(b);
return aa < bb ? -1 : aa > bb ? 1 : 0;
});
export default ascend;