This library is a package of useful functions
Last updated 13 days ago by gtarnopolski .
MIT · Bugs · Original npm · Tarball · package.json
$ cnpm install @codegateinc/g-utils 
SYNC missed versions from official npm registry.

Coverage Status


gUtils is a javascript library that contains functions to make your life simpler


Just simply run in console

yarn add @codegateinc/g-utils or npm install @codegateinc/g-utils


    import { G } from 'gUtils'

    G.is(String, 'test') -> this returns true


function props description
compose (Array<Function>) calls functions in reversed order
cond <T = any, S = any>(array: Array<CondItem<T, S>>) replaces switch with array of conditions
isDefined (subject: any) check if given value is defined and not nullable
ifDefined <T = any>(subject: any, then: (subject: T) => void) calls the function if predicate is defined
call (fn: Function) calls given fn function
T none returns empty function
always <T>(subject: any) always returns given value
hasKeys (subject: any) checks if object has any keys
toPairs <T extends {}>(subject: {[key: string]: any}) extracts object to array of key value tuple
fromPairs <T extends {}>(subject: Array<[string, any]>) returns object made from Array of key value tuple
clearObject (subject: {[key: string]: any}) clears object from nullable or undefined values
values <T extends {}>(subject: {[key: string]: any}) returns object's values as Array
is (type: any, subject: any) validates if give value has provided type
all (Array<boolean>) check if all passed arguments are truthy
hasElements (subject: any): boolean check if given value is array and has got any elements
compareFunctions (a: Function, b: Function): boolean check if given functions are the same
isEmpty (subject: any): boolean check if given value is empty
splitEvery <T = [] \| string>(limit: number, collection: T): Array<T> splits an array or string in given limit

Current Tags

  • 0.0.32                                ...           latest (13 days ago)

11 Versions

  • 0.0.32                                ...           13 days ago
  • 0.0.31                                ...           2 months ago
  • 0.0.28                                ...           2 months ago
  • 0.0.26                                ...           2 months ago
  • 0.0.25                                ...           2 months ago
  • 0.0.24                                ...           2 months ago
  • 0.0.23                                ...           3 months ago
  • 0.0.20                                ...           3 months ago
  • 0.0.18                                ...           3 months ago
  • 0.0.17                                ...           3 months ago
  • 0.0.16                                ...           3 months ago
Today 0
This Week 0
This Month 35
Last Day 0
Last Week 11
Last Month 30
Dependencies (0)
Dev Dependencies (10)

Copyright 2014 - 2016 © taobao.org |