@jaredwray/fumanchu 1.4.1 → 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.
@@ -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
+
@@ -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
- require('falsey');
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.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": [
@@ -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",