no message

This commit is contained in:
A1300399510
2024-01-26 14:12:45 +08:00
parent 2ff4926405
commit 66eb0364d6
180 changed files with 2837 additions and 13232 deletions

View File

@@ -8,9 +8,6 @@ var gOPD = require('gopd');
var $TypeError = GetIntrinsic('%TypeError%');
var $floor = GetIntrinsic('%Math.floor%');
/** @typedef {(...args: unknown[]) => unknown} Func */
/** @type {<T extends Func = Func>(fn: T, length: number, loose?: boolean) => T} */
module.exports = function setFunctionLength(fn, length) {
if (typeof fn !== 'function') {
throw new $TypeError('`fn` is not a function');
@@ -35,9 +32,9 @@ module.exports = function setFunctionLength(fn, length) {
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
if (hasDescriptors) {
define(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true);
define(fn, 'length', length, true, true);
} else {
define(/** @type {Parameters<define>[0]} */ (fn), 'length', length);
define(fn, 'length', length);
}
}
return fn;

View File

@@ -1,6 +1,6 @@
{
"name": "set-function-length",
"version": "1.2.0",
"version": "1.1.1",
"description": "Set a function's length property",
"main": "index.js",
"exports": {
@@ -8,21 +8,15 @@
"./env": "./env.js",
"./package.json": "./package.json"
},
"sideEffects": false,
"directories": {
"test": "test"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated && npm run emit",
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"tsc": "tsc -p .",
"preemit": "rm -f *.ts *.ts.map test/*.ts test/*.ts.map",
"emit": "npm run tsc -- --noEmit false --emitDeclarationOnly",
"postemit": "rm test/*.ts test/*.ts.map",
"prelint": "evalmd README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "npm run tsc",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
@@ -48,38 +42,27 @@
"url": "https://github.com/ljharb/set-function-length/issues"
},
"homepage": "https://github.com/ljharb/set-function-length#readme",
"dependencies": {
"define-data-property": "^1.1.1",
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.2",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.1"
},
"devDependencies": {
"@ljharb/eslint-config": "^21.1.0",
"@types/call-bind": "^1.0.5",
"@types/define-properties": "^1.1.5",
"@types/es-value-fixtures": "^1.4.4",
"@types/for-each": "^0.3.3",
"@types/function-bind": "^1.1.10",
"@types/gopd": "^1.0.3",
"@types/has-property-descriptors": "^1.0.3",
"@types/object-inspect": "^1.8.4",
"@types/tape": "^5.6.4",
"aud": "^2.0.4",
"aud": "^2.0.3",
"auto-changelog": "^2.4.0",
"call-bind": "^1.0.5",
"call-bind": "^1.0.4",
"es-value-fixtures": "^1.4.2",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"for-each": "^0.3.3",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"npmignore": "^0.3.0",
"nyc": "^10.3.2",
"object-inspect": "^1.13.1",
"safe-publish-latest": "^2.0.0",
"tape": "^5.7.3",
"typescript": "^5.4.0-dev.20240113"
"tape": "^5.7.1"
},
"dependencies": {
"define-data-property": "^1.1.1",
"get-intrinsic": "^1.2.1",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
@@ -95,9 +78,7 @@
"publishConfig": {
"ignore": [
".github/workflows",
"test",
"!*.d.ts",
"!*.d.ts.map"
"test"
]
}
}