@reflexions/string-to-boolean 1.0.1 → 1.1.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.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Converts a string to a boolean, treating '0', 'false', 'FALSE', 'off' and falsy values like '' to false, the rest to true.
3
+ */
4
+ declare const stringToBoolean: (value: string | boolean | number | null | undefined) => boolean;
5
+ export default stringToBoolean;
6
+ //# sourceMappingURL=StringToBoolean.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringToBoolean.d.ts","sourceRoot":"","sources":["../../src/StringToBoolean.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,QAAA,MAAM,eAAe,GAAI,OAAO,MAAM,GAAC,OAAO,GAAC,MAAM,GAAC,IAAI,GAAC,SAAS,KAAG,OAMrD,CAAC;AAEnB,eAAe,eAAe,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Converts a string to a boolean, treating '0', 'false', 'FALSE', 'off' and falsy values like '' to false, the rest to true.
5
+ */
6
+ const stringToBoolean = (value) => (typeof value === 'boolean')
7
+ ? value // param is already boolean
8
+ : (typeof value === 'string')
9
+ ? ['0', 'false', 'off'].includes(value.toLowerCase())
10
+ ? false
11
+ : Boolean(value) // returns false for ''; true for non-empty string
12
+ : Boolean(value); // returns false for null or undefined, true for objects
13
+ exports.default = stringToBoolean;
14
+ //# sourceMappingURL=StringToBoolean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringToBoolean.js","sourceRoot":"","sources":["../../src/StringToBoolean.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,MAAM,eAAe,GAAG,CAAC,KAA2C,EAAW,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,SAAS,CAAC;IAC7G,CAAC,CAAC,KAAK,CAAC,2BAA2B;IACnC,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;QAC5B,CAAC,CAAC,CAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YACtD,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,kDAAkD;QACpE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,wDAAwD;AAE5E,kBAAe,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ {"type": "commonjs"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Converts a string to a boolean, treating '0', 'false', 'FALSE', 'off' and falsy values like '' to false, the rest to true.
3
+ */
4
+ declare const stringToBoolean: (value: string | boolean | number | null | undefined) => boolean;
5
+ export default stringToBoolean;
6
+ //# sourceMappingURL=StringToBoolean.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringToBoolean.d.ts","sourceRoot":"","sources":["../../src/StringToBoolean.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,QAAA,MAAM,eAAe,GAAI,OAAO,MAAM,GAAC,OAAO,GAAC,MAAM,GAAC,IAAI,GAAC,SAAS,KAAG,OAMrD,CAAC;AAEnB,eAAe,eAAe,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Converts a string to a boolean, treating '0', 'false', 'FALSE', 'off' and falsy values like '' to false, the rest to true.
3
+ */
4
+ const stringToBoolean = (value) => (typeof value === 'boolean')
5
+ ? value // param is already boolean
6
+ : (typeof value === 'string')
7
+ ? ['0', 'false', 'off'].includes(value.toLowerCase())
8
+ ? false
9
+ : Boolean(value) // returns false for ''; true for non-empty string
10
+ : Boolean(value); // returns false for null or undefined, true for objects
11
+ export default stringToBoolean;
12
+ //# sourceMappingURL=StringToBoolean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringToBoolean.js","sourceRoot":"","sources":["../../src/StringToBoolean.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,eAAe,GAAG,CAAC,KAA2C,EAAW,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,SAAS,CAAC;IAC7G,CAAC,CAAC,KAAK,CAAC,2BAA2B;IACnC,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;QAC5B,CAAC,CAAC,CAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YACtD,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,kDAAkD;QACpE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,wDAAwD;AAE5E,eAAe,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ {"type": "module"}
package/package.json CHANGED
@@ -1,14 +1,28 @@
1
1
  {
2
2
  "name": "@reflexions/string-to-boolean",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
7
- "require": "./cjs/StringToBoolean.cjs",
8
- "default": "./esm/StringToBoolean.mjs"
7
+ "require": {
8
+ "default": "./dist/cjs/StringToBoolean.js",
9
+ "types": "./dist/cjs/StringToBoolean.d.ts"
10
+ },
11
+ "import": {
12
+ "default": "./dist/esm/StringToBoolean.js",
13
+ "types": "./dist/esm/StringToBoolean.d.ts"
14
+ }
9
15
  }
10
16
  },
17
+ "devDependencies": {
18
+ "typescript": "^5.9.2"
19
+ },
20
+ "files": [
21
+ "dist/**/*"
22
+ ],
11
23
  "keywords": [],
24
+ "type": "module",
12
25
  "author": "Reflexions Data, LLC",
13
- "license": "ISC"
26
+ "license": "ISC",
27
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
14
28
  }
package/bump-version.sh DELETED
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # note: realpath isn't always installed, so use pwd in subshell instead
4
- script_dir="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" || exit 1
5
- cd "$script_dir" || exit 1
6
-
7
- git diff-index --quiet HEAD --
8
- has_changes=$?
9
-
10
- if [ $has_changes == 1 ]; then
11
- echo ""
12
- echo "Must commit all changes before publishing"
13
- exit 1
14
- fi
15
-
16
- # bump the version for npm
17
- echo "What type of update is this?"
18
- echo "Options are: A/1 (major), I/2 (minor), P/3 (patch)"
19
-
20
- read -p "Type: " -n 1 -r
21
- echo ''
22
-
23
- version=
24
- if [[ $REPLY =~ ^[Aa1]$ ]]; then
25
- version=$(npm --no-git-tag-version version major)
26
- elif [[ $REPLY =~ ^[Ii2]$ ]]; then
27
- version=$(npm --no-git-tag-version version minor)
28
- elif [[ $REPLY =~ ^[Pp3]$ ]]; then
29
- version=$(npm --no-git-tag-version version patch)
30
- else
31
- echo "Invalid option provided as update type. Valid options are: A, I, P."
32
- exit 1
33
- fi
34
-
35
- if [ -z "$version" ]; then
36
- echo "Failed to update version."
37
- exit 1
38
- fi
39
-
40
- git push \
41
- || { echo "git push failed"; exit 1; }
42
-
43
- echo "Successfully published $version"
@@ -1,16 +0,0 @@
1
- 'use strict'
2
-
3
- /**
4
- * Converts a string to a boolean, treating '0', 'false', 'FALSE', 'off' and falsy values like '' to false, the rest to true.
5
- * @param {string|boolean} value
6
- * @returns Boolean
7
- */
8
- const stringToBoolean = (value) => typeof value === 'boolean'
9
- ? value // param is already boolean
10
- : typeof value === 'string'
11
- ? [ '0', 'false', 'off' ].includes(value.toLowerCase())
12
- ? false
13
- : Boolean(value) // returns false for ''; true for non-empty string
14
- : Boolean(value); // returns false for null or undefined, true for objects
15
-
16
- module.exports = stringToBoolean;
@@ -1,14 +0,0 @@
1
- /**
2
- * Converts a string to a boolean, treating '0', 'false', 'FALSE', 'off' and falsy values like '' to false, the rest to true.
3
- * @param {string|boolean} value
4
- * @returns Boolean
5
- */
6
- const stringToBoolean = (value) => typeof value === 'boolean'
7
- ? value // param is already boolean
8
- : typeof value === 'string'
9
- ? [ '0', 'false', 'off' ].includes(value.toLowerCase())
10
- ? false
11
- : Boolean(value) // returns false for ''; true for non-empty string
12
- : Boolean(value); // returns false for null or undefined, true for objects
13
-
14
- export default stringToBoolean;
package/publish.sh DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env bash
2
- exec npm publish --access public