UNPKG

f-utility

Version:

functional utilities

28 lines (26 loc) 541 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * @method not * @param {*} x - any * @returns {boolean} !x * @public * @example * import {pipe, not} from 'f-utility' * const isOdd = pipe( * (x) => x % 2 === 0, * not * ) */ var not = exports.not = function not(x) { return !x; }; var invert = exports.invert = function invert(x) { return Object.keys(x).reduce(function (o, key) { var value = x[key]; o[value] = o[value] ? o[value].concat(key) : [key]; return o; }, {}); };