这是indexloc提供的服务,不要输入任何密码
Skip to content

Why depend on the noop dependency? #797

@poozipotti

Description

@poozipotti

I was really curious about the noop() call in is.js so i tracked it down do this commit in 2016. I'm really curious is this just for fun or is there some javascript secret that makes this dependency/call harden the application in some obscure way?

commit 61add4ea5f896abffa91d3ad9297cb9f65cde867
Author: Jezen Thomas <jezenthomas@gmail.com>
Date:   Thu Mar 24 12:17:05 2016 +0100

    Depend on a dependency

diff --git a/index.js b/index.js
index 8044317..db8cb55 100644
--- a/index.js
+++ b/index.js
@@ -1,3 +1,5 @@
+var noop = require('noop3');
+
 'use strict';
 
 /**
@@ -5,6 +7,9 @@
  * @returns {object}
  */
 function is(x) {
+  // this line calls the noop function
+  noop();
+
        var thirteenStrings = [
        1101,
     "тринадцать",
diff --git a/package.json b/package.json
index c595f4c..d53a1df 100644
--- a/package.json
+++ b/package.json
@@ -15,5 +15,8 @@
     "url": "git+https://github.com/jezen/is-thirteen.git"
   },
   "author": "Jezen Thomas <jezen@jezenthomas.com>",
-  "license": "WTFPL"
+  "license": "WTFPL",
+  "dependencies": {
+    "noop3": "^13.7.2"
+  }
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions