Coder Social home page Coder Social logo

nop's Introduction

nop

a library for providing a javascript function that does nothing; it's like super useful

Build Status

endorse

use case

Did you know every time you create a do-nothing no-op function you're consuming memory? You can literally save maybe a whole byte or two by using this nop library.

Anybody who cares about being efficient and doesn't care about being rediculous should use this library.

examples

default callback

var nop = require('nop');

function example(options) {
  options = options || {};
  options.success = options.success || nop;
  options.error = options.error || nop;

  // do stuff
  options.success();
}

feel like calling a function, but don't want it to do anything and don't want to create it myself

var nop = require('nop');

var a = 'a';
var b = 'b';
// do you think I should call a function now?
var c = 'c';
// nah, I'll wait
var d = 'd';
var e = 'e';
var f = 'f';
// maybe now
nop();
var g = 'g';
// can I do another?
var h = 'h';
var j = 'j';
// sure... I guess
nop();
nop();
// hey, you were supposed to just do one
var i = 'i';
// sorry
var j = 'j';
// alright, then, as long as you're sorry
var k = 'ok';

nop's People

Contributors

supershabam avatar unional avatar evanhahn avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.