@jaredwray/fumanchu 1.4.0 → 1.5.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/index.d.ts +3 -4
- package/lib/utils/falsey.js +46 -0
- package/lib/utils/utils.js +2 -1
- package/package.json +5 -3
package/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default handlebars;
|
|
1
|
+
import * as Handlebars from 'handlebars';
|
|
2
|
+
import { handlebarHelpers } from './handlebarHelpers';
|
|
3
|
+
export = Handlebars;
|
|
5
4
|
export { handlebarHelpers };
|
|
@@ -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": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"homepage": "https://github.com/jaredwray/fumanchu",
|
|
6
6
|
"author": "Jared Wray (me@jaredwray.com)",
|
|
7
7
|
"keywords": [
|
|
@@ -117,10 +117,11 @@
|
|
|
117
117
|
"array-sort": "^1.0.0",
|
|
118
118
|
"create-frame": "^1.0.0",
|
|
119
119
|
"define-property": "^2.0.2",
|
|
120
|
-
"ent": "^2.2.
|
|
121
|
-
"
|
|
120
|
+
"ent": "^2.2.1",
|
|
121
|
+
"extend-shallow": "^3.0.2",
|
|
122
122
|
"for-in": "^1.0.2",
|
|
123
123
|
"for-own": "^1.0.0",
|
|
124
|
+
"fs-exists-sync": "^0.1.0",
|
|
124
125
|
"get-object": "^0.2.0",
|
|
125
126
|
"get-value": "^3.0.1",
|
|
126
127
|
"handlebars": "^4.7.8",
|
|
@@ -137,6 +138,7 @@
|
|
|
137
138
|
"lazy-cache": "^2.0.2",
|
|
138
139
|
"logging-helpers": "^1.0.0",
|
|
139
140
|
"micromatch": "^4.0.7",
|
|
141
|
+
"path": "^0.12.7",
|
|
140
142
|
"relative": "^3.0.2",
|
|
141
143
|
"remarkable": "^2.0.1",
|
|
142
144
|
"striptags": "^3.2.0",
|