Coder Social home page Coder Social logo

node-noop's Introduction

node-noop

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.

  • Antoine de Saint-Exupery

What it does

Magikarp uses splash attack

Installation

npm install node-noop

Usage

var noop = require('node-noop').noop;
require('fs').writeFile('file.out',"Ignore write failure",noop);

Reviews

"Everything that is wrong with the Node ecosystem." โ€” An enlightened Reddit user

Alternatives

The npm package noop (github here) already has this basic functionality, but it doesn't do it in a very node-like way. It just sticks the noop function on the global scope when you require it.

node-noop's People

Contributors

aklinkert avatar dependabot-preview[bot] avatar dependabot[bot] avatar euank avatar foiseworth avatar iliana avatar jsdevel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-noop's Issues

API Docs unclear

The API documentation is unclear.

Will this package work with the void keyword?

Is this package still maintained??

No checkins in more than 3 months, dependencies are out of date, longstanding issues (3+ years) with no responses.. can we get some love here please??

Add bower package

I am using bower in my projects, so it would be great if to install this awesome package using bower.

Test for global mutation insufficient

I'm not sure if this:

https://github.com/euank/node-noop/blob/master/test/test.js#L12-L16

is sufficient to test that noop did not mutate any state.

Does assert.equal do deep equality testing or does it just compare references? I'm afraid it is the latter.

Also even deep equality testing might be not enough. There may be objects that are not referenced in the global object, or things that are not accessible through node API to see if they have been changed or not (think pending setTimeout callbacks that might have been cancelled). I think we may eventually come up with some way of dumping internal node state, hashing that, and comparing before and after noop call.

Separate from browser and node

This's too complicated when it supports 2 major things in one file. I think we should have 2 files browser.js and node.js so people can decide using one of them, I don't want my bundled JS to contain useless node function.

Misleading package name

We installed this package hoping that it wouldn't do anything.
we were shocked to find out that it actually did something...
to our souls.

Add a license

I am so happy to finally meet such a useful npm module! But there is no license, so I do not know whether I am allowed to use node-noop in my commercial projects or not. Please add a license, it is very important.

Please include tests

I don't have time to read the source, so can you please get 100% test coverage so I trust this lib?

Add support for AMD modules (Require.js)

Because compatibility.

Something along these lines would do:

(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define([], factory);
    } else if (typeof module === 'object' && module.exports) {
        // Node.
        module.exports = factory();
    } else {
        // Browser globals (root is window)
        root.noop = factory();
  }
}(this, function () {
    // Return a value to define the module export.
    return function noop(){};
}));

"should not mutate global" test not valid

The "should not mutate global" is not working as intended:

  it('should not mutate global', function() {
    var globalBefore = global;
    noop.noop();
    assert.equal(globalBefore, global);
  });

var globalBefore = global; only copies the reference to the global object, it does not create a copy. When assert.equals compares global with globalBefore the reference is still the same, even if global has been mutated in the meantime. So this test is always successful.

I'd post a PR to fix this, but I'm not sure what would be the best way to actually identify mutations. You could clone (e.g. using Lodash) the global object, but that isn't very elegant and I'm not even sure if it would work.

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.