@aryth/util-bound
Advanced tools
Comparing version 0.1.9 to 0.1.10
@@ -5,7 +5,9 @@ 'use strict'; | ||
var typen = require('typen'); | ||
var enumCheckLevels = require('@typen/enum-check-levels'); | ||
var numLoose = require('@typen/num-loose'); | ||
var numStrict = require('@typen/num-strict'); | ||
const NUM_LEVEL_NONE = 0; | ||
const NUM_LEVEL_LOOSE = 1; | ||
const NUM_LEVEL_STRICT = 2; | ||
const NUM_LEVEL_NONE = enumCheckLevels.NONE; | ||
const NUM_LEVEL_LOOSE = enumCheckLevels.LOOSE; | ||
const NUM_LEVEL_STRICT = enumCheckLevels.STRICT; | ||
const NumLevel = { | ||
@@ -17,28 +19,14 @@ none: NUM_LEVEL_NONE, | ||
const IsNum = (level = 0) => { | ||
switch (level) { | ||
case 0: | ||
return x => !isNaN(x); | ||
case 1: | ||
return typen.NumLoose.isNumeric; | ||
case 2: | ||
default: | ||
return typen.Num.isNumeric; | ||
} | ||
const IsNum = (level = enumCheckLevels.NONE) => { | ||
if (level === enumCheckLevels.NONE) return x => !isNaN(x); | ||
if (level === enumCheckLevels.LOOSE) return numLoose.isNumeric; | ||
if (level === enumCheckLevels.STRICT) return numStrict.isNumeric; | ||
return numStrict.isNumeric; | ||
}; | ||
const ToNum = (level = 0) => { | ||
switch (level) { | ||
case 0: | ||
return x => x; | ||
case 1: | ||
return typen.NumLoose.numeric; | ||
case 2: | ||
default: | ||
return typen.Num.numeric; | ||
} | ||
if (level === enumCheckLevels.NONE) return x => x; | ||
if (level === enumCheckLevels.LOOSE) return numLoose.parseNum; | ||
if (level === enumCheckLevels.STRICT) return numStrict.parseNum; | ||
return numStrict.parseNum; | ||
}; | ||
@@ -69,1 +57,2 @@ | ||
exports.ToNum = ToNum; | ||
exports.boundOutput = boundOutput; |
@@ -1,6 +0,8 @@ | ||
import { Num, NumLoose } from 'typen'; | ||
import { NONE, LOOSE, STRICT } from '@typen/enum-check-levels'; | ||
import { isNumeric, parseNum } from '@typen/num-loose'; | ||
import { isNumeric as isNumeric$1, parseNum as parseNum$1 } from '@typen/num-strict'; | ||
const NUM_LEVEL_NONE = 0; | ||
const NUM_LEVEL_LOOSE = 1; | ||
const NUM_LEVEL_STRICT = 2; | ||
const NUM_LEVEL_NONE = NONE; | ||
const NUM_LEVEL_LOOSE = LOOSE; | ||
const NUM_LEVEL_STRICT = STRICT; | ||
const NumLevel = { | ||
@@ -12,28 +14,14 @@ none: NUM_LEVEL_NONE, | ||
const IsNum = (level = 0) => { | ||
switch (level) { | ||
case 0: | ||
return x => !isNaN(x); | ||
case 1: | ||
return NumLoose.isNumeric; | ||
case 2: | ||
default: | ||
return Num.isNumeric; | ||
} | ||
const IsNum = (level = NONE) => { | ||
if (level === NONE) return x => !isNaN(x); | ||
if (level === LOOSE) return isNumeric; | ||
if (level === STRICT) return isNumeric$1; | ||
return isNumeric$1; | ||
}; | ||
const ToNum = (level = 0) => { | ||
switch (level) { | ||
case 0: | ||
return x => x; | ||
case 1: | ||
return NumLoose.numeric; | ||
case 2: | ||
default: | ||
return Num.numeric; | ||
} | ||
if (level === NONE) return x => x; | ||
if (level === LOOSE) return parseNum; | ||
if (level === STRICT) return parseNum$1; | ||
return parseNum$1; | ||
}; | ||
@@ -57,2 +45,2 @@ | ||
export { BoundOutput, IsNum, NUM_LEVEL_LOOSE, NUM_LEVEL_NONE, NUM_LEVEL_STRICT, NumLevel, ToNum }; | ||
export { BoundOutput, IsNum, NUM_LEVEL_LOOSE, NUM_LEVEL_NONE, NUM_LEVEL_STRICT, NumLevel, ToNum, boundOutput }; |
{ | ||
"name": "@aryth/util-bound", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "A math util library", | ||
@@ -18,2 +18,5 @@ "main": "dist/index.cjs.js", | ||
"dependencies": { | ||
"@typen/enum-check-levels": "^0.1.1", | ||
"@typen/num-loose": "^0.1.1", | ||
"@typen/num-strict": "^0.1.1", | ||
"typen": "^0.2.0" | ||
@@ -36,3 +39,3 @@ }, | ||
"homepage": "https://github.com/hoyeungw/aryth#readme", | ||
"gitHead": "2ec613356e3ef3c2830d2ef3a1432b5d99925919" | ||
"gitHead": "4cd961e05a538dddd74f9433385d855ea68072c9" | ||
} |
@@ -0,0 +0,0 @@ # @aryth/util-bound |
Sorry, the diff of this file is not supported yet
5999
4
87
+ Added@typen/num-loose@^0.1.1
+ Added@typen/num-strict@^0.1.1
+ Added@typen/enum-check-levels@0.1.19(transitive)
+ Added@typen/enum-data-types@0.1.19(transitive)
+ Added@typen/num-loose@0.1.19(transitive)
+ Added@typen/num-strict@0.1.19(transitive)
+ Added@typen/typ@0.1.19(transitive)