Skip to content
forked from Tinkoff/utils.js

JavaScript utility library for simplifying the work with data, functions, promises, etc

License

Notifications You must be signed in to change notification settings

markelog/utils.js

 
 

Repository files navigation

Tinkoff Utils Build Coverage Status

Fast, small and purely functional utility library

Install

$ npm install @tinkoff/utils

Features

Structure of the library

  • /object – for objects
  • /string – for strings
  • /promise – for promises
  • /array – for arrays or array-like objects
  • /function – for functions – composition, currying and so on, also a set of simple functions (noop, T, F)
  • /is – set of type checking methods
  • / – root contains utilities which don't satisfy any of the above categories or are universal

Usage

import pathOr from '@tinkoff/utils/object/pathOr';
import compose from '@tinkoff/utils/function/compose';
import toLower from '@tinkoff/utils/string/toLower';
import map from '@tinkoff/utils/array/map'

const toLowerName = compose(
    toLower,
    pathOr(['name'], '')
);
const result = map(toLowerName)([{name: 'testA'}, {name: 'testb'}])

Benchmarks

$ npm run benchmark
Utility Lodash Ramda Utils
clone 120,807 ops/sec 112,053 ops/sec 293,572 ops/sec
array/filter 2,080,728 ops/sec 1,849,633 ops/sec 2,046,113 ops/sec
is/empty 1,506,963 ops/sec 474,177 ops/sec 3,731,564 ops/sec
function/flip 7,528,745 ops/sec 3,735,143 ops/sec 3,490,207 ops/sec
object/path 12,023,128 ops/sec 8,894,639 ops/sec 7,587,076 ops/sec
string/trim 4,215,928 ops/sec 1,034,655 ops/sec 6,029,794 ops/sec

Bundle size

Library Bundle size
import _ from 'lodash' 70.1 kb
import ... from 'lodash/...' 21.8 kb
import R from 'ramda' 41.3 kb
import ... from 'ramda/src/...' 10 kb
import ... from '@tinkoff/utils/...' 2.32 kb

For detailed comparison with specific libraries see COMPARE.md

About

JavaScript utility library for simplifying the work with data, functions, promises, etc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%