noop
Provides a few global functions such as `noop`, `throwop`, and `doop`
Last updated 5 years ago by coolaj86 .
MIT OR CC0-1.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install noop 
SYNC missed versions from official npm registry.

node-noop

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

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

Features

  • [x] Works with Promises and Thunks
  • [x] Faster than Object (always true-y)
  • [x] More predictable than Boolean (sometimes false-y)
  • [x] 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/.

Current Tags

  • 1.0.1                                ...           latest (5 years ago)

4 Versions

  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.2.2                                ...           15 years ago
  • 0.2.0                                ...           15 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |