Skip to content

Commit

Permalink
[Breaking] migrate package to match is-nan 1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jun 25, 2022
1 parent b7b5cdc commit 71f4c0c
Show file tree
Hide file tree
Showing 29 changed files with 406 additions and 242 deletions.
5 changes: 5 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"root": true,

"extends": "@ljharb",
}
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -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/number.isnan
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']
18 changes: 18 additions & 0 deletions .github/workflows/node-aught.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Tests: node.js < 10'

on: [pull_request, push]

jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '< 10'
type: minors
command: npm run tests-only

node:
name: 'node < 10'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
7 changes: 7 additions & 0 deletions .github/workflows/node-pretest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: 'Tests: pretest/posttest'

on: [pull_request, push]

jobs:
tests:
uses: ljharb/actions/.github/workflows/pretest.yml@main
18 changes: 18 additions & 0 deletions .github/workflows/node-tens.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Tests: node.js >= 10'

on: [pull_request, push]

jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 10'
type: minors
command: npm run tests-only

node:
name: 'node >= 10'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
15 changes: 15 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Automatic Rebase

on: [pull_request_target]

jobs:
_:
name: "Automatic Rebase"

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ljharb/rebase@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/require-allow-edits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Require “Allow Edits”

on: [pull_request_target]

jobs:
_:
name: "Require “Allow Edits”"

runs-on: ubuntu-latest

steps:
- uses: ljharb/require-allow-edits@main
26 changes: 24 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
.DS_Store
node_modules/
# gitignore
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

npm-debug.log
node_modules

# Only apps should have lockfiles
npm-shrinkwrap.json
package-lock.json
yarn.lock

coverage/
.nyc_output/
31 changes: 26 additions & 5 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
.DS_Store
node_modules/
test/
.travis.yml
testling.html
# gitignore
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

npm-debug.log
node_modules

# Only apps should have lockfiles
npm-shrinkwrap.json
package-lock.json
yarn.lock

coverage/
.nyc_output/

.github/workflows
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
9 changes: 9 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
]
}
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.md → LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Leon de Rijke
Copyright (c) 2014 Jordan Harband

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
Expand Down
94 changes: 46 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,55 @@
# ES6 `Number.isNaN` polyfill
# number.isnan <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![Build status](https://travis-ci.org/leonderijke/Number.isNaN.svg?branch=master)](https://travis-ci.org/leonderijke/Number.isNaN)
[![Dependency Status](https://david-dm.org/leonderijke/Number.isNaN.svg?theme=shields.io)](https://david-dm.org/leonderijke/Number.isNaN)
[![devDependency Status](https://david-dm.org/leonderijke/Number.isNaN/dev-status.svg?theme=shields.io)](https://david-dm.org/leonderijke/Number.isNaN#info=devDependencies)
[![browser support](https://ci.testling.com/leonderijke/Number.isNaN.png)
](https://ci.testling.com/leonderijke/Number.isNaN)
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

A polyfill for [the `Number.isNaN` method in ECMAScript 6](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isnan).
[![npm badge][npm-badge-png]][package-url]

Other polyfills for `Number.isNaN` are available:
ES2015-compliant shim for Number.isNaN.

* <https://github.com/ljharb/is-nan> by [Jordan Harband](https://twitter.com/ljharb)
* <https://github.com/paulmillr/es6-shim/blob/0.10.1/es6-shim.js#L726-L733> by [Paul Miller](http://paulmillr.com/)
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-number.isnan).

## Installation

Via [bower](http://bower.io/):

```bash
bower install Number.isNaN
```

Then, in a browser:

```html
<script src="bower_components/Number.isNaN/isnan.js"></script>
```

Via [npm](http://npmjs.org/):

```bash
npm install number.isnan
```

Then, in [Node.js](http://nodejs.org/):
## Example

```js
require('number.isnan');

// On Windows and on Mac systems with default settings, case doesn’t matter,
// which allows you to do this instead:
require('Number.isNaN');
Number.isNaN = require('number.isnan');
var assert = require('assert');

assert.notOk(Number.isNaN(undefined));
assert.notOk(Number.isNaN(null));
assert.notOk(Number.isNaN(false));
assert.notOk(Number.isNaN(true));
assert.notOk(Number.isNaN(0));
assert.notOk(Number.isNaN(42));
assert.notOk(Number.isNaN(Infinity));
assert.notOk(Number.isNaN(-Infinity));
assert.notOk(Number.isNaN('foo'));
assert.notOk(Number.isNaN(function () {}));
assert.notOk(Number.isNaN([]));
assert.notOk(Number.isNaN({}));

assert.ok(Number.isNaN(NaN));
```

## Relevant links

Find more information about `Number.isNaN` here:

* https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isnan
* http://wiki.ecmascript.org/doku.php?id=harmony:number.isnan
* http://ariya.ofilabs.com/2014/05/the-curious-case-of-javascript-nan.html
* http://www.2ality.com/2012/02/nan-infinity.html

## License

MIT License
## Tests
Simply clone the repo, `npm install`, and run `npm test`

[package-url]: https://npmjs.org/package/number.isnan
[npm-version-svg]: https://versionbadg.es/es-shims/number.isnan.svg
[deps-svg]: https://david-dm.org/es-shims/Number.isNaN.svg
[deps-url]: https://david-dm.org/es-shims/Number.isNaN
[dev-deps-svg]: https://david-dm.org/es-shims/Number.isNaN/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/Number.isNaN#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/number.isnan.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/number.isnan.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/number.isnan.svg
[downloads-url]: https://npm-stat.com/charts.html?package=number.isnan
[codecov-image]: https://codecov.io/gh/es-shims/Number.isNaN/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/Number.isNaN/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Number.isNaN
[actions-url]: https://github.com/es-shims/Number.isNaN/actions
3 changes: 3 additions & 0 deletions auto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

require('./shim')();
26 changes: 0 additions & 26 deletions bower.json

This file was deleted.

7 changes: 7 additions & 0 deletions implementation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */

module.exports = function isNaN(value) {
return value !== value;
};
20 changes: 20 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

var callBind = require('call-bind');
var define = require('define-properties');

var implementation = require('./implementation');
var getPolyfill = require('./polyfill');
var shim = require('./shim');

var polyfill = callBind(getPolyfill(), Number);

/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */

define(polyfill, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});

module.exports = polyfill;
30 changes: 0 additions & 30 deletions isnan.js

This file was deleted.

Loading

0 comments on commit 71f4c0c

Please sign in to comment.