Socket
Socket
Sign inDemoInstall

is-callable

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-callable - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

35

.jscs.json

@@ -12,3 +12,6 @@ {

"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
"requireCurlyBraces": {
"allExcept": [],
"keywords": ["if", "else", "for", "while", "do", "try", "catch"]
},

@@ -20,2 +23,3 @@ "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"],

"disallowSpaceBeforeComma": true,
"disallowSpaceAfterComma": false,
"disallowSpaceBeforeSemicolon": true,

@@ -32,3 +36,3 @@

"requireObjectKeysOnNewLine": true,
"requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] },

@@ -82,3 +86,3 @@ "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },

"requireDotNotation": true,
"requireDotNotation": { "allExcept": ["keywords"] },

@@ -128,4 +132,27 @@ "requireParenthesesAroundIIFE": true,

"validateOrderInObjectKeys": "asc-insensitive"
"validateOrderInObjectKeys": "asc-insensitive",
"disallowIdenticalDestructuringNames": true,
"disallowNestedTernaries": { "maxLevel": 1 },
"requireSpaceAfterComma": { "allExcept": ["trailing"] },
"requireAlignedMultilineParams": false,
"requireSpacesInGenerator": {
"afterStar": true
},
"disallowSpacesInGenerator": {
"beforeStar": true
},
"disallowVar": false,
"requireArrayDestructuring": false,
"requireEnhancedObjectLiterals": false,
"requireObjectDestructuring": false
}

@@ -0,1 +1,9 @@

1.1.1 / 2015-11-30
=================
* [Fix] do not throw when a non-function has a function in its [[Prototype]] (#2)
* [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config`, `jscs`, `nsp`, `semver`
* [Tests] up to `node` `v5.1`
* [Tests] no longer allow node 0.8 to fail.
* [Tests] fix npm upgrades in older nodes
1.1.0 / 2015-10-02

@@ -2,0 +10,0 @@ =================

'use strict';
var constructorRegex = /\s*class /;
var isNonES6ClassFn = function isNonES6ClassFn(value) {
try {
return !constructorRegex.test(value);
} catch (e) {
return false; // not a function
}
};
var fnToStr = Function.prototype.toString;
var tryFunctionObject = function tryFunctionObject(value) {
try {
if (constructorRegex.test(value)) { return false; }
fnToStr.call(value);

@@ -15,3 +25,2 @@ return true;

var genClass = '[object GeneratorFunction]';
var constructorRegex = /\s*class /;
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';

@@ -22,6 +31,6 @@

if (typeof value !== 'function' && typeof value !== 'object') { return false; }
if (constructorRegex.test(value)) { return false; }
if (hasToStringTag) { return tryFunctionObject(value); }
if (!isNonES6ClassFn(value)) { return false; }
var strClass = toStr.call(value);
return strClass === fnClass || strClass === genClass;
};

32

package.json
{
"name": "is-callable",
"version": "1.1.0",
"author": "Jordan Harband",
"version": "1.1.1",
"author": {
"name": "Jordan Harband",
"email": "ljharb@gmail.com",
"url": "http://ljharb.codes"
},
"contributors": [
{
"name": "Jordan Harband",
"email": "ljharb@gmail.com",
"url": "http://ljharb.codes"
}
],
"description": "Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.",

@@ -9,3 +20,4 @@ "license": "MIT",

"scripts": {
"test": "npm run lint && node --es-staging test.js && npm run security",
"test": "npm run lint && npm run tests-only && npm run security",
"tests-only": "node --es-staging test.js",
"coverage": "covert test.js",

@@ -17,3 +29,3 @@ "coverage-quiet": "covert test.js --quiet",

"eccheck": "editorconfig-tools check *.js **/*.js > /dev/null",
"security": "nsp package"
"security": "nsp check"
},

@@ -38,12 +50,12 @@ "repository": {

"devDependencies": {
"tape": "^4.2.0",
"tape": "^4.2.2",
"covert": "^1.1.0",
"jscs": "^2.2.1",
"jscs": "^2.6.0",
"editorconfig-tools": "^0.1.1",
"nsp": "^1.1.0",
"eslint": "^1.5.1",
"@ljharb/eslint-config": "^1.2.0",
"nsp": "^2.0.2",
"eslint": "^1.10.1",
"@ljharb/eslint-config": "^1.6.0",
"make-arrow-function": "^1.1.0",
"make-generator-function": "^1.1.0",
"semver": "^5.0.3",
"semver": "^5.1.0",
"foreach": "^2.0.5"

@@ -50,0 +62,0 @@ },

'use strict';
/* eslint no-magic-numbers: 1 */
var test = require('tape');

@@ -16,3 +18,3 @@ var isCallable = require('./');

classConstructor = makeClassConstructor();
} catch (e) {/**/}
} catch (e) { /**/ }

@@ -48,2 +50,10 @@ test('not callables', function (t) {

t.test('non-function with function in its [[Prototype]] chain', function (st) {
var Foo = function Bar() {};
Foo.prototype = function () {};
st.equal(true, isCallable(Foo), 'sanity check: Foo is callable');
st.equal(false, isCallable(new Foo()), 'instance of Foo is not callable');
st.end();
});
t.end();

@@ -50,0 +60,0 @@ });

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc