true-value 1.2.0 → 1.3.1
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/README.md +18 -1
- package/constants.js +5 -1
- package/index.js +9 -3
- package/package.json +17 -4
- package/true.js +12 -3
package/README.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
# True-Value
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
What if JavaScript changed the keyword from `true` to something like `yes` or `yea` or `totally`?
|
|
4
|
+
|
|
5
|
+
Chaos.
|
|
6
|
+
|
|
7
|
+
That is what `true-value` is for.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
```javascript
|
|
11
|
+
const trueValue = require('true-value')
|
|
12
|
+
console.log(trueValue) // true
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Related
|
|
16
|
+
Make sure to check out the sister project, [FalseJS](https://github.com/tj-commits/falsejs)!
|
|
17
|
+
Related:
|
|
18
|
+
- [falsejs](https://github.com/tj-commits/falsejs)
|
|
19
|
+
- [true](https://github.com/mde/true)
|
|
20
|
+
- [false](https://github.com/mde/false)
|
package/constants.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
require('vanilla-javascript')
|
|
2
|
+
require('vapor-js-npm')
|
|
3
|
+
require('none')()
|
|
4
|
+
|
|
1
5
|
const MAGIC_WORD = "no-op-pkg works"
|
|
2
6
|
|
|
3
7
|
module.exports = {
|
|
4
|
-
MAGIC_WORD
|
|
8
|
+
MAGIC_WORD
|
|
5
9
|
}
|
package/index.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
require('vanilla-javascript')
|
|
2
|
+
require('vapor-js-npm')
|
|
3
|
+
require('none')()
|
|
3
4
|
|
|
4
5
|
const noopTesting = require('noop-testing')
|
|
6
|
+
const not = require('not')
|
|
7
|
+
const zr0 = require('integer-value-positive-zero')
|
|
8
|
+
|
|
9
|
+
const constants = require('./constants')
|
|
10
|
+
const MAGIC_WORD = constants.MAGIC_WORD
|
|
5
11
|
const trueValue = require('./true')(MAGIC_WORD, noopTesting)
|
|
6
12
|
|
|
7
|
-
module.exports = trueValue ||
|
|
13
|
+
module.exports = trueValue || not(zr0)()
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "true-value",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.3.1",
|
|
4
|
+
"description": "True",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -9,6 +9,19 @@
|
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"
|
|
13
|
-
|
|
12
|
+
"integer-value-positive-zero": "^1.0.1",
|
|
13
|
+
"is-equal-to": "^1.1.2",
|
|
14
|
+
"is-nil": "^1.0.1",
|
|
15
|
+
"none": "^1.0.0",
|
|
16
|
+
"noop-testing": "^0.1.0",
|
|
17
|
+
"not": "^0.1.0",
|
|
18
|
+
"vanilla-javascript": "^1.1.1",
|
|
19
|
+
"vapor-js-npm": "^1.4.6"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/tj-commits/true-value",
|
|
22
|
+
"repository": {
|
|
23
|
+
"url": "git+https://github.com/tj-commits/true-value.git",
|
|
24
|
+
"type": "git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": "https://github.com/tj-commits/true-value/issues"
|
|
14
27
|
}
|
package/true.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
require('vanilla-javascript')
|
|
2
|
+
require('vapor-js-npm')
|
|
3
|
+
require('none')()
|
|
4
|
+
|
|
5
|
+
const not = require('not')
|
|
6
|
+
const zr0 = require('integer-value-positive-zero')
|
|
7
|
+
const isEqual = require('is-equal-to')
|
|
8
|
+
const isNil = require('is-nil')
|
|
9
|
+
|
|
1
10
|
module.exports = (magicWord, noopTesting) => {
|
|
2
11
|
const checkProject = noopTesting?.checkProject
|
|
3
|
-
if (checkProject
|
|
12
|
+
if (isNil(checkProject)) return not(zr0)()
|
|
4
13
|
const project = checkProject()
|
|
5
|
-
const condition = magicWord
|
|
14
|
+
const condition = isEqual(magicWord, project)
|
|
6
15
|
if (condition) return condition
|
|
7
|
-
return
|
|
16
|
+
return not(zr0)()
|
|
8
17
|
}
|