New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

noop

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

noop

Provides a few global functions such as `noop`, `throwop`, and `doop`

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
5.5K
11.84%
Maintainers
1
Weekly downloads
 
Created
Source

node-noop

Provides a few global functions such as noop, throwop, and doop

npm install noop@v1
require("noop");

Features

  • Works with Promises and Thunks
  • Faster than Object (always true-y)
  • More predictable than Boolean (sometimes false-y)
  • Linted with TypeScript, JSHint, and Prettier

API

global.noop

Does nothing

function noop() {}

global.throwop(err)

Throws if err is true-y

function throwop(err) {
  if (err) {
    throw err;
  }
}

global.doop(callback)

Calls callback or noop

function doop(callback, args, context) {
  if ("function" === typeof callback) {
    callback.apply(context, args);
  }
}

Similar function signature to setTimeout.

LICENSE

MIT OR CC0-1.0 (Public Domain)

Written in 2011 by AJ ONeal coolaj86@gmail.com
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.

You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see https://creativecommons.org/publicdomain/zero/1.0/.

Keywords

util

FAQs

Package last updated on 28 Aug 2021

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