Socket
Socket
Sign inDemoInstall

functions-have-names

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

functions-have-names - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

7

CHANGELOG.md

@@ -7,2 +7,9 @@ ### Changelog

#### [v1.2.0](https://github.com/ljharb/functions-have-names/compare/v1.1.1...v1.2.0)
> 21 October 2019
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog` [`7e07444`](https://github.com/ljharb/functions-have-names/commit/7e0744437789641ea462005d2e350ef476aa7141)
- [New] add `boundFunctionsHaveNames()` [`05661be`](https://github.com/ljharb/functions-have-names/commit/05661be26c3c260bb3984e433dc9cea3fd82f9ac)
#### [v1.1.1](https://github.com/ljharb/functions-have-names/compare/v1.1.0...v1.1.1)

@@ -9,0 +16,0 @@

@@ -13,2 +13,8 @@ 'use strict';

var $bind = Function.prototype.bind;
functionsHaveNames.boundFunctionsHaveNames = function boundFunctionsHaveNames() {
return functionsHaveNames() && typeof $bind === 'function' && function f() {}.bind().name !== '';
};
module.exports = functionsHaveNames;

8

package.json
{
"name": "functions-have-names",
"version": "1.1.1",
"version": "1.2.0",
"description": "Does this JS environment support the `name` property on functions?",

@@ -34,5 +34,5 @@ "main": "index.js",

"devDependencies": {
"@ljharb/eslint-config": "^13.1.1",
"auto-changelog": "^1.14.1",
"eslint": "^5.16.0",
"@ljharb/eslint-config": "^14.1.0",
"auto-changelog": "^1.16.1",
"eslint": "^6.5.1",
"tape": "^4.11.0"

@@ -39,0 +39,0 @@ },

@@ -42,1 +42,16 @@ 'use strict';

});
test('boundFunctionsHaveNames', function (t) {
t.equal(typeof hasNames.boundFunctionsHaveNames, 'function', 'is a function');
var fn = function f() {};
if (typeof fn.bind !== 'function') {
t.equal(hasNames.boundFunctionsHaveNames(), false, 'bound functions do not have names, because .bind does not exist');
} else if (hasNames()) {
t.equal(hasNames.boundFunctionsHaveNames(), fn.bind().name !== '', 'bound functions have names');
} else {
t.equal(hasNames.boundFunctionsHaveNames(), false, 'bound functions do not have names, because none do');
}
t.end();
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc