Financial-Times / n-utils

a collection of custom utils

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

n-utils npm version CircleCI Coverage Status Dependencies Known Vulnerabilities

a collection of custom utils built following FP and complement ES6/7 features

quickstart

import { trimObject } from '@financial-times/n-utils'; // partially import any function you need

install

npm install @financial-times/n-utils

collections

object utils

all utils are pure functions that clone the original object and maintains its prototype

trimObject

  const trimmed = trimObject(obj); // remove any key whose value is undefined, null or empty string ''

onlyValues

  const trimmed = onlyValues(obj); // trimObject and remove any key whose value is a function

removeObjectKeys

  const filtered = removeObjectKeys(obj)(['key1', 'key2']); // input can be [String] or String

About

a collection of custom utils


Languages

Language:JavaScript 92.7%Language:Makefile 7.3%