UNPKG

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