New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@codegateinc/g-utils

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codegateinc/g-utils

This library is a package of useful functions

  • 0.0.32
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Coverage Status

gUtils

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

Installation

Just simply run in console

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

Usage

    import { G } from 'gUtils'

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

Props

functionpropsdescription
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
Tnonereturns 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): booleancheck if given value is array and has got any elements
compareFunctions(a: Function, b: Function): booleancheck if given functions are the same
isEmpty(subject: any): booleancheck if given value is empty
splitEvery<T = [] | string>(limit: number, collection: T): Array<T>splits an array or string in given limit

FAQs

Package last updated on 13 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc