Your IP : 216.73.216.86


Current Path : /home/emeraadmin/www/4d695/
Upload File :
Current File : /home/emeraadmin/www/4d695/set-function-length.tar

package.json000064400000007334151701470670007051 0ustar00{
  "_from": "set-function-length@^1.2.1",
  "_id": "set-function-length@1.2.2",
  "_inBundle": false,
  "_integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
  "_location": "/set-function-length",
  "_phantomChildren": {},
  "_requested": {
    "type": "range",
    "registry": true,
    "raw": "set-function-length@^1.2.1",
    "name": "set-function-length",
    "escapedName": "set-function-length",
    "rawSpec": "^1.2.1",
    "saveSpec": null,
    "fetchSpec": "^1.2.1"
  },
  "_requiredBy": [
    "/call-bind"
  ],
  "_resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
  "_shasum": "aac72314198eaed975cf77b2c3b6b880695e5449",
  "_spec": "set-function-length@^1.2.1",
  "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\call-bind",
  "author": {
    "name": "Jordan Harband",
    "email": "ljharb@gmail.com"
  },
  "auto-changelog": {
    "output": "CHANGELOG.md",
    "template": "keepachangelog",
    "unreleased": false,
    "commitLimit": false,
    "backfillLimit": false,
    "hideCredit": true
  },
  "bugs": {
    "url": "https://github.com/ljharb/set-function-length/issues"
  },
  "bundleDependencies": false,
  "dependencies": {
    "define-data-property": "^1.1.4",
    "es-errors": "^1.3.0",
    "function-bind": "^1.1.2",
    "get-intrinsic": "^1.2.4",
    "gopd": "^1.0.1",
    "has-property-descriptors": "^1.0.2"
  },
  "deprecated": false,
  "description": "Set a function's length property",
  "devDependencies": {
    "@arethetypeswrong/cli": "^0.15.1",
    "@ljharb/eslint-config": "^21.1.0",
    "@ljharb/tsconfig": "^0.1.1",
    "@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",
    "auto-changelog": "^2.4.0",
    "call-bind": "^1.0.7",
    "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",
    "nyc": "^10.3.2",
    "object-inspect": "^1.13.1",
    "safe-publish-latest": "^2.0.0",
    "tape": "^5.7.5",
    "typescript": "next"
  },
  "directories": {
    "test": "test"
  },
  "engines": {
    "node": ">= 0.4"
  },
  "exports": {
    ".": "./index.js",
    "./env": "./env.js",
    "./package.json": "./package.json"
  },
  "homepage": "https://github.com/ljharb/set-function-length#readme",
  "keywords": [
    "javascript",
    "ecmascript",
    "set",
    "function",
    "length",
    "function.length"
  ],
  "license": "MIT",
  "main": "index.js",
  "name": "set-function-length",
  "publishConfig": {
    "ignore": [
      ".github/workflows",
      "test"
    ]
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/ljharb/set-function-length.git"
  },
  "scripts": {
    "lint": "eslint --ext=js,mjs .",
    "postlint": "npm run tsc",
    "posttest": "aud --production",
    "posttsc": "attw -P",
    "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
    "prelint": "evalmd README.md",
    "prepack": "npmignore --auto --commentLines=autogenerated",
    "prepublish": "not-in-publish || npm run prepublishOnly",
    "prepublishOnly": "safe-publish-latest",
    "pretest": "npm run lint",
    "test": "npm run tests-only",
    "tests-only": "nyc tape 'test/**/*.js'",
    "tsc": "tsc -p .",
    "version": "auto-changelog && git add CHANGELOG.md"
  },
  "sideEffects": false,
  "version": "1.2.2"
}
LICENSE000064400000002073151701470670005563 0ustar00MIT License

Copyright (c) Jordan Harband and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
.eslintrc000064400000000624151701470670006402 0ustar00{
	"root": true,

	"extends": "@ljharb",

	"rules": {
		"id-length": "off",
		"new-cap": ["error", {
			"capIsNewExceptions": [
				"GetIntrinsic"
			],
		}],
		"no-extra-parens": "off",
	},

	"overrides": [
		{
			"files": ["test/**/*.js"],
			"rules": {
				"id-length": "off",
				"max-lines-per-function": "off",
				"multiline-comment-style": "off",
				"no-empty-function": "off",
			},
		},
	],
}
index.js000064400000002371151701470670006224 0ustar00'use strict';

var GetIntrinsic = require('get-intrinsic');
var define = require('define-data-property');
var hasDescriptors = require('has-property-descriptors')();
var gOPD = require('gopd');

var $TypeError = require('es-errors/type');
var $floor = GetIntrinsic('%Math.floor%');

/** @type {import('.')} */
module.exports = function setFunctionLength(fn, length) {
	if (typeof fn !== 'function') {
		throw new $TypeError('`fn` is not a function');
	}
	if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
		throw new $TypeError('`length` must be a positive 32-bit integer');
	}

	var loose = arguments.length > 2 && !!arguments[2];

	var functionLengthIsConfigurable = true;
	var functionLengthIsWritable = true;
	if ('length' in fn && gOPD) {
		var desc = gOPD(fn, 'length');
		if (desc && !desc.configurable) {
			functionLengthIsConfigurable = false;
		}
		if (desc && !desc.writable) {
			functionLengthIsWritable = false;
		}
	}

	if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
		if (hasDescriptors) {
			define(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true);
		} else {
			define(/** @type {Parameters<define>[0]} */ (fn), 'length', length);
		}
	}
	return fn;
};
env.js000064400000001543151701470670005705 0ustar00'use strict';

var gOPD = require('gopd');
var bind = require('function-bind');

var unbound = gOPD && gOPD(function () {}, 'length');
// @ts-expect-error ts(2555) TS is overly strict with .call
var bound = gOPD && gOPD(bind.call(function () {}), 'length');

var functionsHaveConfigurableLengths = !!(unbound && unbound.configurable);

var functionsHaveWritableLengths = !!(unbound && unbound.writable);

var boundFnsHaveConfigurableLengths = !!(bound && bound.configurable);

var boundFnsHaveWritableLengths = !!(bound && bound.writable);

/** @type {import('./env')} */
module.exports = {
	__proto__: null,
	boundFnsHaveConfigurableLengths: boundFnsHaveConfigurableLengths,
	boundFnsHaveWritableLengths: boundFnsHaveWritableLengths,
	functionsHaveConfigurableLengths: functionsHaveConfigurableLengths,
	functionsHaveWritableLengths: functionsHaveWritableLengths
};
env.d.ts000064400000000336151701470670006140 0ustar00declare const env: {
	__proto__: null,
	boundFnsHaveConfigurableLengths: boolean;
	boundFnsHaveWritableLengths: boolean;
	functionsHaveConfigurableLengths: boolean;
	functionsHaveWritableLengths: boolean;
};

export = env;README.md000064400000004167151701470670006043 0ustar00# set-function-length <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][npm-badge-png]][package-url]

Set a function’s length.

Arguments:
 - `fn`: the function
 - `length`: the new length. Must be an integer between 0 and 2**32.
 - `loose`: Optional. If true, and the length fails to be set, do not throw. Default false.

Returns `fn`.

## Usage

```javascript
var setFunctionLength = require('set-function-length');
var assert = require('assert');

function zero() {}
function one(_) {}
function two(_, __) {}

assert.equal(zero.length, 0);
assert.equal(one.length, 1);
assert.equal(two.length, 2);

assert.equal(setFunctionLength(zero, 10), zero);
assert.equal(setFunctionLength(one, 11), one);
assert.equal(setFunctionLength(two, 12), two);

assert.equal(zero.length, 10);
assert.equal(one.length, 11);
assert.equal(two.length, 12);
```

[package-url]: https://npmjs.org/package/set-function-length
[npm-version-svg]: https://versionbadg.es/ljharb/set-function-length.svg
[deps-svg]: https://david-dm.org/ljharb/set-function-length.svg
[deps-url]: https://david-dm.org/ljharb/set-function-length
[dev-deps-svg]: https://david-dm.org/ljharb/set-function-length/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/set-function-length#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/set-function-length.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/set-function-length.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/set-function-length.svg
[downloads-url]: https://npm-stat.com/charts.html?package=set-function-length
[codecov-image]: https://codecov.io/gh/ljharb/set-function-length/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/set-function-length/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/set-function-length
[actions-url]: https://github.com/ljharb/set-function-length/actions
index.d.ts000064400000000400151701470670006447 0ustar00declare namespace setFunctionLength {
    type Func = (...args: unknown[]) => unknown;
}

declare function setFunctionLength<T extends setFunctionLength.Func = setFunctionLength.Func>(fn: T, length: number, loose?: boolean): T;

export = setFunctionLength;.nycrc000064400000000330151701470670005667 0ustar00{
	"all": true,
	"check-coverage": false,
	"reporter": ["text-summary", "text", "html", "json"],
	"lines": 86,
	"statements": 85.93,
	"functions": 82.43,
	"branches": 76.06,
	"exclude": [
		"coverage",
		"test"
	]
}
tsconfig.json000064400000000164151701470670007264 0ustar00{
	"extends": "@ljharb/tsconfig",
	"compilerOptions": {
		"target": "es2021",
	},
	"exclude": [
		"coverage",
	],
}
CHANGELOG.md000064400000011414151701470670006366 0ustar00# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.2.2](https://github.com/ljharb/set-function-length/compare/v1.2.1...v1.2.2) - 2024-03-09

### Commits

- [types] use shared config [`027032f`](https://github.com/ljharb/set-function-length/commit/027032fe9cc439644a07248ea6a8d813fcc767cb)
- [actions] remove redundant finisher; use reusable workflow [`1fd4fb1`](https://github.com/ljharb/set-function-length/commit/1fd4fb1c58bd5170f0dcff7e320077c0aa2ffdeb)
- [types] use a handwritten d.ts file instead of emit [`01b9761`](https://github.com/ljharb/set-function-length/commit/01b9761742c95e1118e8c2d153ce2ae43d9731aa)
- [Deps] update `define-data-property`, `get-intrinsic`, `has-property-descriptors` [`bee8eaf`](https://github.com/ljharb/set-function-length/commit/bee8eaf7749f325357ade85cffeaeef679e513d4)
- [Dev Deps] update `call-bind`, `tape` [`5dae579`](https://github.com/ljharb/set-function-length/commit/5dae579fdc3aab91b14ebb58f9c19ee3f509d434)
- [Tests] use `@arethetypeswrong/cli` [`7e22425`](https://github.com/ljharb/set-function-length/commit/7e22425d15957fd3d6da0b6bca4afc0c8d255d2d)

## [v1.2.1](https://github.com/ljharb/set-function-length/compare/v1.2.0...v1.2.1) - 2024-02-06

### Commits

- [Dev Deps] update `call-bind`, `tape`, `typescript` [`d9a4601`](https://github.com/ljharb/set-function-length/commit/d9a460199c4c1fa37da9ebe055e2c884128f0738)
- [Deps] update `define-data-property`, `get-intrinsic` [`38d39ae`](https://github.com/ljharb/set-function-length/commit/38d39aed13a757ed36211d5b0437b88485090c6b)
- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`b4bfe5a`](https://github.com/ljharb/set-function-length/commit/b4bfe5ae0953b906d55b85f867eca5e7f673ebf4)

## [v1.2.0](https://github.com/ljharb/set-function-length/compare/v1.1.1...v1.2.0) - 2024-01-14

### Commits

- [New] add types [`f6d9088`](https://github.com/ljharb/set-function-length/commit/f6d9088b9283a3112b21c6776e8bef6d1f30558a)
- [Fix] ensure `env` properties are always booleans [`0c42f84`](https://github.com/ljharb/set-function-length/commit/0c42f84979086389b3229e1b4272697fd352275a)
- [Dev Deps] update `aud`, `call-bind`, `npmignore`, `tape` [`2b75f75`](https://github.com/ljharb/set-function-length/commit/2b75f75468093a4bb8ce8ca989b2edd2e80d95d1)
- [Deps] update `get-intrinsic`, `has-property-descriptors` [`19bf0fc`](https://github.com/ljharb/set-function-length/commit/19bf0fc4ffaa5ad425acbfa150516be9f3b6263a)
- [meta] add `sideEffects` flag [`8bb9b78`](https://github.com/ljharb/set-function-length/commit/8bb9b78c11c621123f725c9470222f43466c01d0)

## [v1.1.1](https://github.com/ljharb/set-function-length/compare/v1.1.0...v1.1.1) - 2023-10-19

### Fixed

- [Fix] move `define-data-property` to runtime deps [`#2`](https://github.com/ljharb/set-function-length/issues/2)

### Commits

- [Dev Deps] update `object-inspect`; add missing `call-bind` [`5aecf79`](https://github.com/ljharb/set-function-length/commit/5aecf79e7d6400957a5d9bd9ac20d4528908ca18)

## [v1.1.0](https://github.com/ljharb/set-function-length/compare/v1.0.1...v1.1.0) - 2023-10-13

### Commits

- [New] add `env` entry point [`475c87a`](https://github.com/ljharb/set-function-length/commit/475c87aa2f59b700aaed589d980624ec596acdcb)
- [Tests] add coverage with `nyc` [`14f0bf8`](https://github.com/ljharb/set-function-length/commit/14f0bf8c145ae60bf14a026420a06bb7be132c36)
- [eslint] fix linting failure [`fb516f9`](https://github.com/ljharb/set-function-length/commit/fb516f93c664057138c53559ef63c8622a093335)
- [Deps] update `define-data-property` [`d727e7c`](https://github.com/ljharb/set-function-length/commit/d727e7c6c9a40d7bf26797694e500ea68741feea)

## [v1.0.1](https://github.com/ljharb/set-function-length/compare/v1.0.0...v1.0.1) - 2023-10-12

### Commits

- [Refactor] use `get-intrinsic`, since it‘s in the dep graph anyways [`278a954`](https://github.com/ljharb/set-function-length/commit/278a954a06cd849051c569ff7aee56df6798933e)
- [meta] add `exports` [`72acfe5`](https://github.com/ljharb/set-function-length/commit/72acfe5a0310071fb205a72caba5ecbab24336a0)

## v1.0.0 - 2023-10-12

### Commits

- Initial implementation, tests, readme [`fce14e1`](https://github.com/ljharb/set-function-length/commit/fce14e17586460e4f294405173be72b6ffdf7e5f)
- Initial commit [`ca7ba85`](https://github.com/ljharb/set-function-length/commit/ca7ba857c7c283f9d26e21f14e71cd388f2cb722)
- npm init [`6a7e493`](https://github.com/ljharb/set-function-length/commit/6a7e493927736cebcaf5c1a84e69b8e6b7b744d8)
- Only apps should have lockfiles [`d2bf6c4`](https://github.com/ljharb/set-function-length/commit/d2bf6c43de8a51b02a0aa53e8d62cb50c4a2b0da)
.github/FUNDING.yml000064400000001063151701470670007731 0ustar00# These are supported funding model platforms

github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/set-function-name
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with a single custom sponsorship URL