Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @tinkoff/utils with all npm packages installed. Try it out:

@tinkoff/utils lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("@tinkoff/utils/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@tinkoff/utils v1.0.2

Fast, small and purely functional utility library

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
UtilityLodashRamdaUtils
clone120,807 ops/sec112,053 ops/sec293,572 ops/sec
array/filter2,080,728 ops/sec1,849,633 ops/sec2,046,113 ops/sec
is/empty1,506,963 ops/sec474,177 ops/sec3,731,564 ops/sec
function/flip7,528,745 ops/sec3,735,143 ops/sec3,490,207 ops/sec
object/path12,023,128 ops/sec8,894,639 ops/sec7,587,076 ops/sec
string/trim4,215,928 ops/sec1,034,655 ops/sec6,029,794 ops/sec

Bundle size

LibraryBundle 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

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free