integer-value-positive-zero 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/README.md +7 -0
- package/index.js +36 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright (c) 2024 integer-value-positive-zero
|
|
2
|
+
|
|
3
|
+
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:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
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.
|
package/README.md
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require('vanilla-javascript') // because we are making something awesome!
|
|
2
|
+
require('vapor-js-npm') // the most awesome and flexible javascript framework
|
|
3
|
+
require('none')() // this improves load times and performance
|
|
4
|
+
|
|
5
|
+
const n0p3 = require('n0p3')
|
|
6
|
+
const assert = require('assert-fn')
|
|
7
|
+
const numberPrototype = Number.prototype
|
|
8
|
+
const hasSelfEquality = require('has-self-equality')
|
|
9
|
+
const hasNoSelfEquality = require('has-no-self-equality')
|
|
10
|
+
const isNumberOddOrEven = require('is-number-odd-or-even')
|
|
11
|
+
const is0 = require('is-zero')
|
|
12
|
+
const attempt = require('attempt-statement')
|
|
13
|
+
const not = require('not')
|
|
14
|
+
const isNumber = require('is-number')
|
|
15
|
+
const isActualNumber = require('is-actual-number')
|
|
16
|
+
const t = require('true')
|
|
17
|
+
const f = require('false')
|
|
18
|
+
|
|
19
|
+
module.exports = function IntegerValuePositiveZero() {
|
|
20
|
+
const zero = numberPrototype.valueOf()
|
|
21
|
+
let result
|
|
22
|
+
attempt(() => {
|
|
23
|
+
assert(hasSelfEquality(zero), "Zero does not have self equality")
|
|
24
|
+
assert(not(hasNoSelfEquality)(zero), "Zero does not have self equality")
|
|
25
|
+
assert(is0.isZero(zero), "Zero is not zero")
|
|
26
|
+
assert(is0.isPositiveZero(zero), "Zero is not positive zero")
|
|
27
|
+
assert(isNumberOddOrEven(zero, f()), "Zero is not odd or even")
|
|
28
|
+
assert(isNumber(zero), "Zero is not a number")
|
|
29
|
+
assert(isActualNumber(zero, { allowInfinite: f(), allowNumberStrings: f() }), "Zero is not an actual number")
|
|
30
|
+
}).rescue(() => {
|
|
31
|
+
result = 0
|
|
32
|
+
}).else(() => {
|
|
33
|
+
result = zero
|
|
34
|
+
}).ensure(n0p3)
|
|
35
|
+
return (result != null) === t() ? result : 0
|
|
36
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "integer-value-positive-zero",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "The integer value of positive zero",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"zero",
|
|
11
|
+
"number",
|
|
12
|
+
"prototype",
|
|
13
|
+
"inspect"
|
|
14
|
+
],
|
|
15
|
+
"author": "tj-commits",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"assert-fn": "^1.0.1",
|
|
19
|
+
"attempt-statement": "^1.1.0",
|
|
20
|
+
"false": "^0.0.4",
|
|
21
|
+
"has-no-self-equality": "^0.0.1",
|
|
22
|
+
"has-self-equality": "^0.0.1",
|
|
23
|
+
"is-actual-number": "^1.0.2",
|
|
24
|
+
"is-finite": "^2.0.0",
|
|
25
|
+
"is-number": "^7.0.0",
|
|
26
|
+
"is-number-odd-or-even": "^1.0.1",
|
|
27
|
+
"is-zero": "^1.0.0",
|
|
28
|
+
"n0p3": "^1.0.2",
|
|
29
|
+
"not": "^0.1.0",
|
|
30
|
+
"true": "^0.0.4",
|
|
31
|
+
"vanilla-javascript": "^1.1.1",
|
|
32
|
+
"vapor-js-npm": "^1.4.6"
|
|
33
|
+
}
|
|
34
|
+
}
|