+284
-129
lines changedFilter options
+284
-129
lines changed Original file line number Diff line number Diff line change
@@ -318,7 +318,7 @@ graph LR;
318
318
glob-->minimatch;
319
319
glob-->minipass;
320
320
glob-->path-scurry;
321
-
has-->function-bind;
321
+
hasown-->function-bind;
322
322
hosted-git-info-->lru-cache;
323
323
http-proxy-agent-->agent-base;
324
324
http-proxy-agent-->debug;
@@ -334,7 +334,7 @@ graph LR;
334
334
init-package-json-->validate-npm-package-license;
335
335
init-package-json-->validate-npm-package-name;
336
336
is-cidr-->cidr-regex;
337
-
is-core-module-->has;
337
+
is-core-module-->hasown;
338
338
isaacs-cliui-->string-width-cjs;
339
339
isaacs-cliui-->string-width;
340
340
isaacs-cliui-->strip-ansi-cjs;
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@
117
117
!/glob
118
118
!/graceful-fs
119
119
!/has-unicode
120
-
!/has
120
+
!/hasown
121
121
!/hosted-git-info
122
122
!/http-cache-semantics
123
123
!/http-proxy-agent
Original file line number Diff line number Diff line change
@@ -3,43 +3,75 @@
3
3
/* eslint no-invalid-this: 1 */
4
4
5
5
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
6
-
var slice = Array.prototype.slice;
7
6
var toStr = Object.prototype.toString;
7
+
var max = Math.max;
8
8
var funcType = '[object Function]';
9
9
10
+
var concatty = function concatty(a, b) {
11
+
var arr = [];
12
+
13
+
for (var i = 0; i < a.length; i += 1) {
14
+
arr[i] = a[i];
15
+
}
16
+
for (var j = 0; j < b.length; j += 1) {
17
+
arr[j + a.length] = b[j];
18
+
}
19
+
20
+
return arr;
21
+
};
22
+
23
+
var slicy = function slicy(arrLike, offset) {
24
+
var arr = [];
25
+
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
26
+
arr[j] = arrLike[i];
27
+
}
28
+
return arr;
29
+
};
30
+
31
+
var joiny = function (arr, joiner) {
32
+
var str = '';
33
+
for (var i = 0; i < arr.length; i += 1) {
34
+
str += arr[i];
35
+
if (i + 1 < arr.length) {
36
+
str += joiner;
37
+
}
38
+
}
39
+
return str;
40
+
};
41
+
10
42
module.exports = function bind(that) {
11
43
var target = this;
12
-
if (typeof target !== 'function' || toStr.call(target) !== funcType) {
44
+
if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
13
45
throw new TypeError(ERROR_MESSAGE + target);
14
46
}
15
-
var args = slice.call(arguments, 1);
47
+
var args = slicy(arguments, 1);
16
48
17
49
var bound;
18
50
var binder = function () {
19
51
if (this instanceof bound) {
20
52
var result = target.apply(
21
53
this,
22
-
args.concat(slice.call(arguments))
54
+
concatty(args, arguments)
23
55
);
24
56
if (Object(result) === result) {
25
57
return result;
26
58
}
27
59
return this;
28
-
} else {
29
-
return target.apply(
30
-
that,
31
-
args.concat(slice.call(arguments))
32
-
);
33
60
}
61
+
return target.apply(
62
+
that,
63
+
concatty(args, arguments)
64
+
);
65
+
34
66
};
35
67
36
-
var boundLength = Math.max(0, target.length - args.length);
68
+
var boundLength = max(0, target.length - args.length);
37
69
var boundArgs = [];
38
70
for (var i = 0; i < boundLength; i++) {
39
-
boundArgs.push('$' + i);
71
+
boundArgs[i] = '$' + i;
40
72
}
41
73
42
-
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
74
+
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
43
75
44
76
if (target.prototype) {
45
77
var Empty = function Empty() {};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "function-bind",
3
-
"version": "1.1.1",
3
+
"version": "1.1.2",
4
4
"description": "Implementation of Function.prototype.bind",
5
5
"keywords": [
6
6
"function",
@@ -9,7 +9,13 @@
9
9
"es5"
10
10
],
11
11
"author": "Raynos <raynos2@gmail.com>",
12
-
"repository": "git://github.com/Raynos/function-bind.git",
12
+
"repository": {
13
+
"type": "git",
14
+
"url": "https://github.com/Raynos/function-bind.git"
15
+
},
16
+
"funding": {
17
+
"url": "https://github.com/sponsors/ljharb"
18
+
},
13
19
"main": "index",
14
20
"homepage": "https://github.com/Raynos/function-bind",
15
21
"contributors": [
@@ -25,24 +31,29 @@
25
31
"url": "https://github.com/Raynos/function-bind/issues",
26
32
"email": "raynos2@gmail.com"
27
33
},
28
-
"dependencies": {},
29
34
"devDependencies": {
30
-
"@ljharb/eslint-config": "^12.2.1",
31
-
"covert": "^1.1.0",
32
-
"eslint": "^4.5.0",
33
-
"jscs": "^3.0.7",
34
-
"tape": "^4.8.0"
35
+
"@ljharb/eslint-config": "^21.1.0",
36
+
"aud": "^2.0.3",
37
+
"auto-changelog": "^2.4.0",
38
+
"eslint": "=8.8.0",
39
+
"in-publish": "^2.0.1",
40
+
"npmignore": "^0.3.0",
41
+
"nyc": "^10.3.2",
42
+
"safe-publish-latest": "^2.0.0",
43
+
"tape": "^5.7.1"
35
44
},
36
45
"license": "MIT",
37
46
"scripts": {
47
+
"prepublishOnly": "safe-publish-latest",
48
+
"prepublish": "not-in-publish || npm run prepublishOnly",
49
+
"prepack": "npmignore --auto --commentLines=autogenerated",
38
50
"pretest": "npm run lint",
39
51
"test": "npm run tests-only",
40
-
"posttest": "npm run coverage -- --quiet",
41
-
"tests-only": "node test",
42
-
"coverage": "covert test/*.js",
43
-
"lint": "npm run jscs && npm run eslint",
44
-
"jscs": "jscs *.js */*.js",
45
-
"eslint": "eslint *.js */*.js"
52
+
"posttest": "aud --production",
53
+
"tests-only": "nyc tape 'test/**/*.js'",
54
+
"lint": "eslint --ext=js,mjs .",
55
+
"version": "auto-changelog && git add CHANGELOG.md",
56
+
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
46
57
},
47
58
"testling": {
48
59
"files": "test/index.js",
@@ -59,5 +70,18 @@
59
70
"iphone/6.0..latest",
60
71
"android-browser/4.2..latest"
61
72
]
73
+
},
74
+
"auto-changelog": {
75
+
"output": "CHANGELOG.md",
76
+
"template": "keepachangelog",
77
+
"unreleased": false,
78
+
"commitLimit": false,
79
+
"backfillLimit": false,
80
+
"hideCredit": true
81
+
},
82
+
"publishConfig": {
83
+
"ignore": [
84
+
".github/workflows"
85
+
]
62
86
}
63
87
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
1
+
MIT License
2
+
3
+
Copyright (c) Jordan Harband and contributors
4
+
5
+
Permission is hereby granted, free of charge, to any person obtaining a copy
6
+
of this software and associated documentation files (the "Software"), to deal
7
+
in the Software without restriction, including without limitation the rights
8
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+
copies of the Software, and to permit persons to whom the Software is
10
+
furnished to do so, subject to the following conditions:
11
+
12
+
The above copyright notice and this permission notice shall be included in all
13
+
copies or substantial portions of the Software.
14
+
15
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+
SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
1
+
'use strict';
2
+
3
+
var call = Function.prototype.call;
4
+
var $hasOwn = Object.prototype.hasOwnProperty;
5
+
var bind = require('function-bind');
6
+
7
+
/** @type {(o: {}, p: PropertyKey) => p is keyof o} */
8
+
module.exports = bind.call(call, $hasOwn);
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4