to-percent-js
Advanced tools
Comparing version 0.3.4 to 0.4.0
"use strict"; | ||
var _interopRequireDefault = require("reshow-runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.toNum = exports.toInt = exports.round = exports.percent = exports.getNum = exports["default"] = void 0; | ||
var _typeof2 = _interopRequireDefault(require("reshow-runtime/helpers/typeof")); | ||
var _reshowConstant = require("reshow-constant"); | ||
var numTypes = "|number|".concat(_reshowConstant.STRING, "|"); | ||
var numTypes = "|" + _reshowConstant.NUMBER + "|" + _reshowConstant.STRING + "|"; | ||
@@ -31,7 +25,8 @@ var toPercent = function toPercent(num) { | ||
exports.round = round; | ||
var ERROR_INFO = "Get number fail."; | ||
var toNum = function toNum(num) { | ||
if (_reshowConstant.UNDEFINED === (0, _typeof2["default"])(num)) { | ||
if (_reshowConstant.UNDEFINED === typeof num) { | ||
return 0; | ||
} else if (-1 === numTypes.indexOf("|" + (0, _typeof2["default"])(num) + "|") || !num) { | ||
} else if (-1 === numTypes.indexOf("|" + typeof num + "|") || !num) { | ||
var maybeNaN = Number(num); | ||
@@ -61,3 +56,3 @@ return isNaN(maybeNaN) ? 0 : maybeNaN; | ||
console.warn("Can not change to number well.", { | ||
console.warn(ERROR_INFO, { | ||
willNum: willNum, | ||
@@ -83,3 +78,3 @@ maybeString: maybeString, | ||
var getNum = function getNum(s) { | ||
if (_reshowConstant.STRING !== (0, _typeof2["default"])(s)) { | ||
if (_reshowConstant.STRING !== typeof s) { | ||
return toNum(s); | ||
@@ -91,3 +86,3 @@ } | ||
if (!match) { | ||
console.warn("Get number fail", s); | ||
console.warn(ERROR_INFO, s); | ||
return 0; | ||
@@ -94,0 +89,0 @@ } else { |
{ | ||
"version": "0.4.0", | ||
"name": "to-percent-js", | ||
"version": "0.3.4", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/react-atomic/react-atomic-organism", | ||
"directory": "packages/lib/to-percent-js" | ||
}, | ||
"homepage": "https://github.com/react-atomic/react-atomic-organism/tree/main/packages/lib/to-percent-js", | ||
"description": "Change number to percentage.", | ||
"repository": "react-atomic/react-atomic-organism", | ||
"main": "./build/cjs/src/index.js", | ||
"module": "./build/es/src/index.js", | ||
"keywords": [], | ||
@@ -17,16 +20,25 @@ "author": "Hill <hill@kimo.com>", | ||
"@babel/cli": "^7.x", | ||
"chai": "*", | ||
"mocha": "*" | ||
"reshow-unit-dom": "*" | ||
}, | ||
"exports": { | ||
"require": "./build/cjs/src/index.js", | ||
"import": "./build/es/src/index.mjs" | ||
}, | ||
"main": "./build/cjs/src/index.js", | ||
"module": "./build/es/src/index.mjs", | ||
"scripts": { | ||
"clean": "find ./build -name '*.*' | xargs rm -rf", | ||
"build:cjs": "BABEL_ENV=cjs babel src -d build/cjs/src --ignore /**/__tests__ --root-mode upward", | ||
"build:es": "BABEL_ENV=es babel src -d build/es/src --out-file-extension .mjs --root-mode upward", | ||
"build": "npm run clean && npm run build:cjs && npm run build:es", | ||
"build:cjs": "BABEL_ENV=cjs babel src -d build/cjs/src --root-mode upward", | ||
"build:es": "BABEL_ENV=es babel src -d build/es/src --root-mode upward", | ||
"mochaFor": "mocha", | ||
"mocha": "npm run mochaFor -- 'build/cjs/**/__tests__/*.js'", | ||
"mocha": "npm run mochaFor -- 'build/es/**/__tests__/*.mjs'", | ||
"test": "npm run build && npm run mocha", | ||
"prepublishOnly": "npm run test" | ||
}, | ||
"files": ["build", "package.json", "README.md"] | ||
"files": [ | ||
"build", | ||
"package.json", | ||
"README.md" | ||
] | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2
9222
5
258
1