You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
428 B
19 lines
428 B
7 years ago
|
const JSON = require('./cycle');
|
||
|
|
||
|
const always = x => _ => x;
|
||
|
const isNonZeroFalsy = _ => (
|
||
|
(Boolean(_) === false) && _ !== 0
|
||
|
);
|
||
|
const stringify = _ => {
|
||
|
return ((typeof _ === 'object' && _ !== null) ?
|
||
|
JSON.stringify(JSON.decycle(_), null, 2) :
|
||
|
_.toString())
|
||
|
};
|
||
|
const areNumbers = (...items) => items.every(x => (typeof x === 'number' && x !== NaN));
|
||
|
|
||
|
module.exports = {
|
||
|
always,
|
||
|
isNonZeroFalsy,
|
||
|
stringify,
|
||
|
areNumbers
|
||
|
}
|