@jaredwray/fumanchu 1.4.1 → 2.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/lib/utils/falsey.js +46 -0
- package/lib/utils/utils.js +2 -1
- package/package.json +7 -8
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// utils.js
|
|
2
|
+
function falsey(val, keywords) {
|
|
3
|
+
if (!val) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
let words = keywords || [
|
|
8
|
+
"0",
|
|
9
|
+
"false",
|
|
10
|
+
"nada",
|
|
11
|
+
"nil",
|
|
12
|
+
"nay",
|
|
13
|
+
"nah",
|
|
14
|
+
"negative",
|
|
15
|
+
"no",
|
|
16
|
+
"none",
|
|
17
|
+
"nope",
|
|
18
|
+
"nul",
|
|
19
|
+
"null",
|
|
20
|
+
"nix",
|
|
21
|
+
"nyet",
|
|
22
|
+
"uh-uh",
|
|
23
|
+
"veto",
|
|
24
|
+
"zero",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
if (!Array.isArray(words)) {
|
|
28
|
+
words = [words];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const lower = typeof val === "string" ? val.toLowerCase() : null;
|
|
32
|
+
|
|
33
|
+
for (const word of words) {
|
|
34
|
+
if (word === val) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
if (word === lower) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = falsey;
|
|
46
|
+
|
package/lib/utils/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var utils = require('lazy-cache')(require);
|
|
4
|
+
var falsey = require('./falsey');
|
|
4
5
|
var fn = require;
|
|
5
6
|
require = utils;
|
|
6
7
|
|
|
@@ -18,7 +19,7 @@ require('kind-of', 'typeOf');
|
|
|
18
19
|
// matching utils
|
|
19
20
|
require('is-glob');
|
|
20
21
|
require('micromatch', 'mm');
|
|
21
|
-
|
|
22
|
+
utils.falsey = falsey;
|
|
22
23
|
|
|
23
24
|
// Number utils
|
|
24
25
|
require('is-even');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaredwray/fumanchu",
|
|
3
3
|
"description": "Handlebars + Helpers = Fumanchu",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"homepage": "https://github.com/jaredwray/fumanchu",
|
|
6
6
|
"author": "Jared Wray (me@jaredwray.com)",
|
|
7
7
|
"keywords": [
|
|
@@ -103,12 +103,12 @@
|
|
|
103
103
|
"require": "./index.js"
|
|
104
104
|
},
|
|
105
105
|
"engines": {
|
|
106
|
-
"node": ">=
|
|
106
|
+
"node": ">=20"
|
|
107
107
|
},
|
|
108
108
|
"scripts": {
|
|
109
109
|
"test": "c8 mocha --reporter list",
|
|
110
110
|
"test:ci": "c8 --reporter=lcov mocha --reporter list",
|
|
111
|
-
"clean": "rimraf ./node_modules ./coverage yarn.lock package-lock.json",
|
|
111
|
+
"clean": "rimraf ./node_modules ./coverage yarn.lock package-lock.json ./dist ./dist-site",
|
|
112
112
|
"website:build": "rimraf ./site/readme.md && npx -y docula build -s ./site -o ./dist-site",
|
|
113
113
|
"website:serve": "rimraf ./site/readme.md && npx -y docula serve -s ./site -o ./dist-site"
|
|
114
114
|
},
|
|
@@ -119,7 +119,6 @@
|
|
|
119
119
|
"define-property": "^2.0.2",
|
|
120
120
|
"ent": "^2.2.1",
|
|
121
121
|
"extend-shallow": "^3.0.2",
|
|
122
|
-
"falsey": "^1.0.0",
|
|
123
122
|
"for-in": "^1.0.2",
|
|
124
123
|
"for-own": "^1.0.0",
|
|
125
124
|
"fs-exists-sync": "^0.1.0",
|
|
@@ -130,7 +129,7 @@
|
|
|
130
129
|
"handlebars-utils": "^1.0.6",
|
|
131
130
|
"has-value": "^2.0.2",
|
|
132
131
|
"helper-date": "^1.0.1",
|
|
133
|
-
"highlight.js": "^11.
|
|
132
|
+
"highlight.js": "^11.10.0",
|
|
134
133
|
"html-tag": "^2.0.0",
|
|
135
134
|
"is-even": "^1.0.0",
|
|
136
135
|
"is-glob": "^4.0.3",
|
|
@@ -150,10 +149,10 @@
|
|
|
150
149
|
"c8": "^10.1.2",
|
|
151
150
|
"chai": "^4.3.10",
|
|
152
151
|
"lodash": "^4.17.21",
|
|
153
|
-
"mocha": "^10.
|
|
154
|
-
"rimraf": "^
|
|
152
|
+
"mocha": "^10.7.3",
|
|
153
|
+
"rimraf": "^6.0.1",
|
|
155
154
|
"template-helpers": "^1.0.1",
|
|
156
155
|
"templates": "^1.2.9",
|
|
157
|
-
"typescript": "^5.5.
|
|
156
|
+
"typescript": "^5.5.4"
|
|
158
157
|
}
|
|
159
158
|
}
|