mirror of
https://github.com/musix-org/musix-oss
synced 2025-07-06 22:10:49 +00:00
fix
This commit is contained in:
20
node_modules/is-natural-number/LICENSE
generated
vendored
Normal file
20
node_modules/is-natural-number/LICENSE
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 - 2016 Shinnosuke Watanabe
|
||||
|
||||
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.
|
76
node_modules/is-natural-number/README.md
generated
vendored
Normal file
76
node_modules/is-natural-number/README.md
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
# is-natural-number.js
|
||||
|
||||
[](https://www.npmjs.com/package/is-natural-number)
|
||||
[](https://github.com/shinnn/is-natural-number.js/releases)
|
||||
[](https://travis-ci.org/shinnn/is-natural-number.js)
|
||||
[](https://coveralls.io/r/shinnn/is-natural-number.js?branch=master)
|
||||
[](https://david-dm.org/shinnn/is-natural-number.js#info=devDependencies)
|
||||
|
||||
Check if a value is a [natural number](https://wikipedia.org/wiki/Natural_number)
|
||||
|
||||
## Installation
|
||||
|
||||
### Package managers
|
||||
|
||||
#### [npm](https://www.npmjs.com/)
|
||||
|
||||
```
|
||||
npm install is-natural-number
|
||||
```
|
||||
|
||||
#### [Bower](http://bower.io/)
|
||||
|
||||
```
|
||||
bower install is-natural-number
|
||||
```
|
||||
|
||||
#### [Duo](http://duojs.org/)
|
||||
|
||||
```javascript
|
||||
var isNaturalNumber = require('shinnn/is-natural-number.js');
|
||||
```
|
||||
|
||||
### Standalone
|
||||
|
||||
[Download the script file directly.](https://raw.githubusercontent.com/shinnn/is-natural-number.js/master/is-natural-number.js)
|
||||
|
||||
## API
|
||||
|
||||
### isNaturalNumber(*number*, *option*)
|
||||
|
||||
*number*: `Number`
|
||||
*option*: `Object`
|
||||
Return: `Boolean`
|
||||
|
||||
It returns `true` if the first argument is one of the natural numbers. If not, or the argument is not a number, it returns `false`.
|
||||
|
||||
```javascript
|
||||
isNaturalNumber(10); //=> true
|
||||
|
||||
isNaturalNumber(-10); //=> false
|
||||
isNaturalNumber(10.5); //=> false
|
||||
isNaturalNumber(Infinity); //=> false
|
||||
isNaturalNumber('10'); //=> false
|
||||
```
|
||||
|
||||
*Check [the test](./test.js) for more detailed specifications.*
|
||||
|
||||
#### option.includeZero
|
||||
|
||||
Type: `Boolean`
|
||||
Default: `false`
|
||||
|
||||
By default the number `0` is not regarded as a natural number.
|
||||
|
||||
Setting this option `true` makes `0` regarded as a natural number.
|
||||
|
||||
```javascript
|
||||
isNaturalNumber(0); //=> false
|
||||
isNaturalNumber(0, {includeZero: true}); //=> true
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2014 - 2016 [Shinnosuke Watanabe](https://github.com/shinnn)
|
||||
|
||||
Licensed under [the MIT License](./LICENSE).
|
31
node_modules/is-natural-number/index.js
generated
vendored
Normal file
31
node_modules/is-natural-number/index.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
/*!
|
||||
* is-natural-number.js | MIT (c) Shinnosuke Watanabe
|
||||
* https://github.com/shinnn/is-natural-number.js
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
module.exports = function isNaturalNumber(val, option) {
|
||||
if (option) {
|
||||
if (typeof option !== 'object') {
|
||||
throw new TypeError(
|
||||
String(option) +
|
||||
' is not an object. Expected an object that has boolean `includeZero` property.'
|
||||
);
|
||||
}
|
||||
|
||||
if ('includeZero' in option) {
|
||||
if (typeof option.includeZero !== 'boolean') {
|
||||
throw new TypeError(
|
||||
String(option.includeZero) +
|
||||
' is neither true nor false. `includeZero` option must be a Boolean value.'
|
||||
);
|
||||
}
|
||||
|
||||
if (option.includeZero && val === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Number.isSafeInteger(val) && val >= 1;
|
||||
};
|
29
node_modules/is-natural-number/index.jsnext.js
generated
vendored
Normal file
29
node_modules/is-natural-number/index.jsnext.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
/*!
|
||||
* is-natural-number.js | MIT (c) Shinnosuke Watanabe
|
||||
* https://github.com/shinnn/is-natural-number.js
|
||||
*/
|
||||
export default function isNaturalNumber(val, option) {
|
||||
if (option) {
|
||||
if (typeof option !== 'object') {
|
||||
throw new TypeError(
|
||||
String(option) +
|
||||
' is not an object. Expected an object that has boolean `includeZero` property.'
|
||||
);
|
||||
}
|
||||
|
||||
if ('includeZero' in option) {
|
||||
if (typeof option.includeZero !== 'boolean') {
|
||||
throw new TypeError(
|
||||
String(option.includeZero) +
|
||||
' is neither true nor false. `includeZero` option must be a Boolean value.'
|
||||
);
|
||||
}
|
||||
|
||||
if (option.includeZero && val === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Number.isSafeInteger(val) && val >= 1;
|
||||
}
|
74
node_modules/is-natural-number/package.json
generated
vendored
Normal file
74
node_modules/is-natural-number/package.json
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"_from": "is-natural-number@^4.0.1",
|
||||
"_id": "is-natural-number@4.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=",
|
||||
"_location": "/is-natural-number",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "is-natural-number@^4.0.1",
|
||||
"name": "is-natural-number",
|
||||
"escapedName": "is-natural-number",
|
||||
"rawSpec": "^4.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/strip-dirs"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz",
|
||||
"_shasum": "ab9d76e1db4ced51e35de0c72ebecf09f734cde8",
|
||||
"_spec": "is-natural-number@^4.0.1",
|
||||
"_where": "C:\\Users\\matia\\Musix\\node_modules\\strip-dirs",
|
||||
"author": {
|
||||
"name": "Shinnosuke Watanabe",
|
||||
"url": "https://github.com/shinnn"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/shinnn/is-natural-number.js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Check if a value is a natural number",
|
||||
"devDependencies": {
|
||||
"@shinnn/eslint-config": "^2.1.0",
|
||||
"eslint": "^2.9.0",
|
||||
"istanbul": "^0.4.3",
|
||||
"require-from-string": "^1.2.0",
|
||||
"rollup": "^0.26.3",
|
||||
"tap-dot": "^1.0.5",
|
||||
"tape": "^4.5.1"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.jsnext.js"
|
||||
],
|
||||
"homepage": "https://github.com/shinnn/is-natural-number.js#readme",
|
||||
"jsnext:main": "index.jsnext.js",
|
||||
"keywords": [
|
||||
"number",
|
||||
"natural",
|
||||
"check",
|
||||
"int",
|
||||
"integer",
|
||||
"math",
|
||||
"mathematics",
|
||||
"range",
|
||||
"browser",
|
||||
"client-side"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "is-natural-number",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/shinnn/is-natural-number.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "node --strong_mode node_modules/.bin/istanbul cover test.js",
|
||||
"pretest": "eslint --config @shinnn --ignore-path .gitignore .",
|
||||
"test": "node --strong_mode --throw-deprecation --track-heap-objects test.js | tap-dot"
|
||||
},
|
||||
"version": "4.0.1"
|
||||
}
|
Reference in New Issue
Block a user