This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@edwardmx/noop
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

noop

No operation module.

You can use this empty function when you wish to pass around a function that will do nothing.

This is useful for components developers who offer optional callbacks

Installation

# Using npm
npm install --save @edwardmx/noop

Example

const noop = require("@edwardmx/noop");

//-------- Case 1
noop();
// Hey, nothing happened!


//-------- Case 2
let person = (name, age, cb) => {
	cb = cb || noop;
	cb(name, age);
};

// Eg. 1
person('Edward', 30, (name, age) => {
	// My name is Edward. I'm 30 years old
	console.log(`My name is ${name}. I'm ${age} years old`);
});


// Eg. 2
person('Edward', 30);
// No error, even we don't send the callback function

/@edwardmx/noop/

    Package Sidebar

    Install

    npm i @edwardmx/noop

    Weekly Downloads

    4

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    9.64 kB

    Total Files

    11

    Last publish

    Collaborators

    • eduardo.delaluz.86