1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.clientOnly = exports.noop = exports.equalRecords = exports.find = exports.arrayify = undefined;
|
7 |
|
8 | var _platform = require("./platform");
|
9 |
|
10 | var arrayify = function arrayify(x) {
|
11 | return Array.isArray(x) ? x : [x];
|
12 | };
|
13 |
|
14 | var find = function find(f, xs) {
|
15 | return xs.reduce(function (b, x) {
|
16 | return b ? b : f(x) ? x : null;
|
17 | }, null);
|
18 | };
|
19 |
|
20 | var equalRecords = function equalRecords(o1, o2) {
|
21 | for (var key in o1) {
|
22 | if (o1[key] !== o2[key]) return false;
|
23 | }return true;
|
24 | };
|
25 |
|
26 | var noop = function noop() {
|
27 | return undefined;
|
28 | };
|
29 |
|
30 | var clientOnly = function clientOnly(f) {
|
31 | return _platform.isClient ? f : noop;
|
32 | };
|
33 |
|
34 | exports.default = {
|
35 | arrayify: arrayify,
|
36 | find: find,
|
37 | equalRecords: equalRecords,
|
38 | noop: noop,
|
39 | clientOnly: clientOnly
|
40 | };
|
41 | exports.arrayify = arrayify;
|
42 | exports.find = find;
|
43 | exports.equalRecords = equalRecords;
|
44 | exports.noop = noop;
|
45 | exports.clientOnly = clientOnly; |
\ | No newline at end of file |