update
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var $abs = require('./abs');
|
||||
var $floor = require('./floor');
|
||||
|
||||
var $isNaN = require('./isNaN');
|
||||
var $isFinite = require('./isFinite');
|
||||
|
||||
/** @type {import('./isInteger')} */
|
||||
module.exports = function isInteger(argument) {
|
||||
if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) {
|
||||
return false;
|
||||
}
|
||||
var absValue = $abs(argument);
|
||||
return $floor(absValue) === absValue;
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
# 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/function-bind
|
||||
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 up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
var BOMChar = '\uFEFF';
|
||||
|
||||
exports.PrependBOM = PrependBOMWrapper
|
||||
function PrependBOMWrapper(encoder, options) {
|
||||
this.encoder = encoder;
|
||||
this.addBOM = true;
|
||||
}
|
||||
|
||||
PrependBOMWrapper.prototype.write = function(str) {
|
||||
if (this.addBOM) {
|
||||
str = BOMChar + str;
|
||||
this.addBOM = false;
|
||||
}
|
||||
|
||||
return this.encoder.write(str);
|
||||
}
|
||||
|
||||
PrependBOMWrapper.prototype.end = function() {
|
||||
return this.encoder.end();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
exports.StripBOM = StripBOMWrapper;
|
||||
function StripBOMWrapper(decoder, options) {
|
||||
this.decoder = decoder;
|
||||
this.pass = false;
|
||||
this.options = options || {};
|
||||
}
|
||||
|
||||
StripBOMWrapper.prototype.write = function(buf) {
|
||||
var res = this.decoder.write(buf);
|
||||
if (this.pass || !res)
|
||||
return res;
|
||||
|
||||
if (res[0] === BOMChar) {
|
||||
res = res.slice(1);
|
||||
if (typeof this.options.stripBOM === 'function')
|
||||
this.options.stripBOM();
|
||||
}
|
||||
|
||||
this.pass = true;
|
||||
return res;
|
||||
}
|
||||
|
||||
StripBOMWrapper.prototype.end = function() {
|
||||
return this.decoder.end();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"name": "math-intrinsics",
|
||||
"version": "1.1.0",
|
||||
"description": "ES Math-related intrinsics and helpers, robustly cached.",
|
||||
"main": false,
|
||||
"exports": {
|
||||
"./abs": "./abs.js",
|
||||
"./floor": "./floor.js",
|
||||
"./isFinite": "./isFinite.js",
|
||||
"./isInteger": "./isInteger.js",
|
||||
"./isNaN": "./isNaN.js",
|
||||
"./isNegativeZero": "./isNegativeZero.js",
|
||||
"./max": "./max.js",
|
||||
"./min": "./min.js",
|
||||
"./mod": "./mod.js",
|
||||
"./pow": "./pow.js",
|
||||
"./sign": "./sign.js",
|
||||
"./round": "./round.js",
|
||||
"./constants/maxArrayLength": "./constants/maxArrayLength.js",
|
||||
"./constants/maxSafeInteger": "./constants/maxSafeInteger.js",
|
||||
"./constants/maxValue": "./constants/maxValue.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run tests-only",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"posttest": "npx npm@'>= 10.2' audit --production",
|
||||
"prelint": "evalmd README.md && eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"postlint": "tsc && attw -P",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/es-shims/math-intrinsics.git"
|
||||
},
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/es-shims/math-intrinsics/issues"
|
||||
},
|
||||
"homepage": "https://github.com/es-shims/math-intrinsics#readme",
|
||||
"devDependencies": {
|
||||
"@arethetypeswrong/cli": "^0.17.1",
|
||||
"@ljharb/eslint-config": "^21.1.1",
|
||||
"@ljharb/tsconfig": "^0.2.2",
|
||||
"@types/for-each": "^0.3.3",
|
||||
"@types/object-inspect": "^1.13.0",
|
||||
"@types/tape": "^5.8.0",
|
||||
"auto-changelog": "^2.5.0",
|
||||
"eclint": "^2.8.1",
|
||||
"es-value-fixtures": "^1.5.0",
|
||||
"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.3",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.9.0",
|
||||
"typescript": "next"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
# gopd <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]
|
||||
|
||||
`Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation.
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var gOPD = require('gopd');
|
||||
var assert = require('assert');
|
||||
|
||||
if (gOPD) {
|
||||
assert.equal(typeof gOPD, 'function', 'descriptors supported');
|
||||
// use gOPD like Object.getOwnPropertyDescriptor here
|
||||
} else {
|
||||
assert.ok(!gOPD, 'descriptors not supported');
|
||||
}
|
||||
```
|
||||
|
||||
[package-url]: https://npmjs.org/package/gopd
|
||||
[npm-version-svg]: https://versionbadg.es/ljharb/gopd.svg
|
||||
[deps-svg]: https://david-dm.org/ljharb/gopd.svg
|
||||
[deps-url]: https://david-dm.org/ljharb/gopd
|
||||
[dev-deps-svg]: https://david-dm.org/ljharb/gopd/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/ljharb/gopd#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/gopd.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/gopd.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/gopd.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=gopd
|
||||
[codecov-image]: https://codecov.io/gh/ljharb/gopd/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/ljharb/gopd/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/gopd
|
||||
[actions-url]: https://github.com/ljharb/gopd/actions
|
||||
Reference in New Issue
Block a user