source: trip-planner-front/node_modules/core-js-compat/helpers.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 636 bytes
Line 
1'use strict';
2const cmp = require('semver/functions/cmp');
3const semver = require('semver/functions/coerce');
4
5const has = Function.call.bind({}.hasOwnProperty);
6
7function compare(a, operator, b) {
8 return cmp(semver(a), operator, semver(b));
9}
10
11function intersection(list, order) {
12 const set = list instanceof Set ? list : new Set(list);
13 return order.filter(name => set.has(name));
14}
15
16function sortObjectByKey(object, fn) {
17 return Object.keys(object).sort(fn).reduce((memo, key) => {
18 memo[key] = object[key];
19 return memo;
20 }, {});
21}
22
23module.exports = {
24 compare,
25 has,
26 intersection,
27 semver,
28 sortObjectByKey,
29};
Note: See TracBrowser for help on using the repository browser.