dynamic-typing
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,25 +0,18 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
/** | ||
* Dynamically type a string | ||
* @param {string} value String to dynamically type | ||
* @returns {boolean|string|number} | ||
*/ | ||
function parseString(value) { | ||
if (value.length === 4 || value.length === 5) { | ||
let lowercase = value.toLowerCase(); | ||
if (lowercase === 'true') return true; | ||
if (lowercase === 'false') return false; | ||
} | ||
let number = Number(value); | ||
if (number === 0 && !value.includes('0')) { | ||
return value; | ||
} | ||
if (!Number.isNaN(number)) return number; | ||
return value; | ||
} | ||
exports.parseString = parseString; | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./parseString"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "dynamic-typing", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Dynamically type a string", | ||
"main": "lib/index.js", | ||
"module": "src/index.js", | ||
"main": "./lib/index.js", | ||
"module": "./lib-esm/index.js", | ||
"types": "./lib/index.d.ts", | ||
"files": [ | ||
"src", | ||
"lib", | ||
"src" | ||
"lib-esm" | ||
], | ||
"scripts": { | ||
"build": "cheminfo-build --entry src/index.js --root DynamicTyping", | ||
"check-types": "tsc --noEmit", | ||
"clean": "rimraf lib lib-esm", | ||
"eslint": "eslint src", | ||
"eslint-fix": "npm run eslint -- --fix", | ||
"prepack": "rollup -c", | ||
"prepack": "npm run tsc", | ||
"prettier": "prettier --check src", | ||
"prettier-write": "prettier --write src", | ||
"test": "npm run test-coverage && npm run eslint && npm run prettier", | ||
"test": "npm run test-coverage && npm run eslint && npm run prettier && npm run check-types", | ||
"test-coverage": "jest --coverage", | ||
"test-only": "jest" | ||
"test-only": "jest", | ||
"tsc": "npm run clean && npm run tsc-cjs && npm run tsc-esm", | ||
"tsc-cjs": "tsc --project tsconfig.cjs.json", | ||
"tsc-esm": "tsc --project tsconfig.esm.json" | ||
}, | ||
@@ -32,14 +40,13 @@ "repository": { | ||
"homepage": "https://github.com/cheminfo/dynamic-typing#readme", | ||
"jest": { | ||
"testEnvironment": "node" | ||
}, | ||
"devDependencies": { | ||
"@babel/plugin-transform-modules-commonjs": "^7.18.6", | ||
"@types/jest": "^28.1.7", | ||
"eslint": "^8.22.0", | ||
"eslint-config-cheminfo": "^8.0.2", | ||
"jest": "^28.1.3", | ||
"@babel/plugin-transform-modules-commonjs": "^7.23.3", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@types/jest": "^29.5.12", | ||
"cheminfo-build": "^1.1.11", | ||
"eslint": "^8.27.0", | ||
"eslint-config-cheminfo-typescript": "^12.2.0", | ||
"jest": "^29.3.1", | ||
"prettier": "^2.7.1", | ||
"rollup": "^2.78.1" | ||
"typescript": "^5.4.2" | ||
} | ||
} |
@@ -7,2 +7,3 @@ # dynamic-typing | ||
[![npm download][download-image]][download-url] | ||
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5482823.svg)](https://doi.org/10.5281/zenodo.5482823) | ||
@@ -9,0 +10,0 @@ ## Dynamically types a string. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10012
21
72
69
9