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

@basekits/kit-function

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@basekits/kit-function

Helper functions kit for basekits.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

@basekits/kit-function

Helper functions kit for basekits.

Install

npm i @basekits/kit-type @basekits/kit-error @basekits/kit-function

Usage

const kit = require('@basekits/core')
const type = require('@basekits/kit-type')
const error = require('@basekits/kit-error')
const fn = require('@basekits/kit-function')
kit.addKit(type)
kit.addKit(error)
kit.addKit(fn)

Available Items

The following methods will be available after adding this kit:

.waitForIt(condition, callback, interval = 300, timeout = 10000)

Runs condition function every interval miliseconds and runs callback if condition function returns true. The callback will also be run if condition doesn't return true after timeout miliseconds.

// wait for library to be available
function checkLib() {
  return 'someLibrary' in window
}

function useLibrary() {
  window.someLibrary.someMethod.call()
}

kit.waitForIt(checkLib, useLibrary)
// interval is 0.3 and timeout is 10 seconds by default

.debounce(func, wait, options)

An article that explains what debounce and throttle does. Implementation of debounce and throttle taken from lodash.


.throttle(func, wait, options)

An article that explains what debounce and throttle does. Implementation of debounce and throttle taken from lodash.


.stringify(value)

Stringifies the input. Input can be one of basekits types: error, object, array, string, number, boolean, null, undefined, nan, date, function, bigint or domelement. It will give you the innerText property in the case of a domElement. Returns an empty string in the case of unrecognized types.


.destringify(value, type = null)

Destringifies the input according to type. Returns value as it is if type left empty. type is one of basekits type.


Keywords

FAQs

Package last updated on 10 Mar 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