@valkyriestudios/utils 4.2.0 → 5.0.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.
- package/.babelrc +1 -0
- package/.eslintrc.json +152 -0
- package/.nyc_output/79bac8a3-26d6-499d-a9d9-6f61d6c11628.json +1 -0
- package/.nyc_output/8a42299e-25b8-4720-a08c-cb83c830059c.json +1 -0
- package/.nyc_output/processinfo/79bac8a3-26d6-499d-a9d9-6f61d6c11628.json +1 -0
- package/.nyc_output/processinfo/8a42299e-25b8-4720-a08c-cb83c830059c.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/.nycrc +4 -0
- package/.travis.yml +2 -3
- package/CHANGELOG.md +43 -0
- package/README.md +20 -4
- package/array/dedupe.js +14 -14
- package/array/is.js +5 -4
- package/array/isNotEmpty.js +8 -9
- package/boolean/is.js +5 -4
- package/caching/memoize.js +14 -19
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/base.css +224 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/block-navigation.js +87 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/favicon.png +0 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/index.html +296 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/prettify.css +1 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/prettify.js +2 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/sorter.js +196 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/array/dedupe.js.html +118 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/array/index.html +146 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/array/is.js.html +100 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/array/isNotEmpty.js.html +109 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/boolean/index.html +116 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/boolean/is.js.html +100 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/caching/index.html +116 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/caching/memoize.js.html +130 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/date/index.html +116 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/date/is.js.html +100 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/deep/define.js.html +106 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/deep/freeze.js.html +151 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/deep/get.js.html +187 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/deep/index.html +176 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/deep/seal.js.html +151 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/deep/set.js.html +220 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/equal.js.html +274 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/formdata/index.html +116 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/formdata/is.js.html +100 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/function/index.html +176 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/function/is.js.html +103 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/function/noop.js.html +100 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/function/noopresolve.js.html +103 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/function/noopreturn.js.html +103 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/function/sleep.js.html +124 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/hash/fnv1A.js.html +232 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/hash/guid.js.html +175 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/hash/index.html +131 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/index.html +131 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/is.js.html +202 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/number/index.html +221 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/number/is.js.html +112 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/number/isAbove.js.html +115 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/number/isBelow.js.html +115 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/number/isBetween.js.html +121 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/number/isNumericalNaN.js.html +100 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/number/randomBetween.js.html +136 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/number/round.js.html +139 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/number/toPercentage.js.html +151 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/object/define.js.html +118 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/object/defineFrozen.js.html +106 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/object/defineSealed.js.html +106 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/object/forValues.js.html +133 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/object/index.html +236 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/object/is.js.html +100 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/object/isNotEmpty.js.html +109 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/object/merge.js.html +157 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/object/pick.js.html +151 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/object/zip.js.html +139 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/regexp/index.html +116 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/regexp/is.js.html +100 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/string/index.html +146 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/string/is.js.html +100 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/string/isBetween.js.html +133 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov-report/src/string/isNotEmpty.js.html +109 -0
- package/coverage/Chrome Headless 100.0.4896.127 (Linux x86_64)/lcov.info +974 -0
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/array/dedupe.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/array/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/array/is.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/array/isNotEmpty.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/boolean/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/boolean/is.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/caching/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/caching/memoize.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/date/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/date/is.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/deep/define.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/deep/freeze.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/deep/get.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/deep/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/deep/seal.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/deep/set.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/equal.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/formdata/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/formdata/is.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/function/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/function/is.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/function/noop.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/function/noopresolve.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/function/noopreturn.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/function/sleep.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/hash/fnv1A.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/hash/guid.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/hash/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/is.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/number/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/number/is.js.html +3 -3
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/number/isBetween.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/number/isNumericalNaN.js.html +2 -2
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/number/randomBetween.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/number/round.js.html +5 -5
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/number/toPercentage.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/object/define.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/object/defineFrozen.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/object/defineSealed.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/object/forValues.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/object/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/object/is.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/object/isNotEmpty.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/object/merge.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/object/pick.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/object/zip.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/regexp/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/regexp/is.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/string/index.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/string/is.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/string/isBetween.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov-report/src/string/isNotEmpty.js.html +1 -1
- package/coverage/Chrome Headless 93.0.4577.82 (Linux x86_64)/lcov.info +20 -20
- package/coverage/lcov-report/base.css +5 -4
- package/coverage/lcov-report/block-navigation.js +71 -48
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +247 -50
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +51 -14
- package/coverage/lcov-report/src/array/dedupe.js.html +145 -0
- package/coverage/lcov-report/src/array/index.html +146 -0
- package/coverage/lcov-report/src/array/is.js.html +100 -0
- package/coverage/lcov-report/src/array/isNotEmpty.js.html +109 -0
- package/coverage/lcov-report/src/boolean/index.html +116 -0
- package/coverage/lcov-report/src/boolean/is.js.html +100 -0
- package/coverage/lcov-report/src/caching/index.html +116 -0
- package/coverage/lcov-report/src/caching/memoize.js.html +139 -0
- package/coverage/lcov-report/src/date/index.html +116 -0
- package/coverage/lcov-report/src/date/is.js.html +100 -0
- package/coverage/lcov-report/src/deep/define.js.html +106 -0
- package/coverage/lcov-report/src/deep/freeze.js.html +151 -0
- package/coverage/lcov-report/src/deep/get.js.html +190 -0
- package/coverage/lcov-report/src/deep/index.html +176 -0
- package/coverage/lcov-report/src/deep/seal.js.html +151 -0
- package/coverage/lcov-report/src/deep/set.js.html +229 -0
- package/coverage/lcov-report/src/equal.js.html +280 -0
- package/coverage/lcov-report/src/function/index.html +176 -0
- package/coverage/lcov-report/src/function/is.js.html +103 -0
- package/coverage/lcov-report/src/function/noop.js.html +100 -0
- package/coverage/lcov-report/src/function/noopresolve.js.html +103 -0
- package/coverage/lcov-report/src/function/noopreturn.js.html +103 -0
- package/coverage/lcov-report/src/function/sleep.js.html +121 -0
- package/coverage/lcov-report/src/hash/fnv1A.js.html +238 -0
- package/coverage/lcov-report/src/hash/guid.js.html +184 -0
- package/coverage/lcov-report/src/hash/index.html +131 -0
- package/coverage/lcov-report/src/index.html +131 -0
- package/coverage/lcov-report/src/is.js.html +196 -0
- package/coverage/lcov-report/src/number/index.html +221 -0
- package/coverage/lcov-report/src/number/is.js.html +109 -0
- package/coverage/lcov-report/src/number/isAbove.js.html +115 -0
- package/coverage/lcov-report/src/number/isBelow.js.html +115 -0
- package/coverage/lcov-report/src/number/isBetween.js.html +121 -0
- package/coverage/lcov-report/src/number/isNumericalNaN.js.html +100 -0
- package/coverage/lcov-report/src/number/randomBetween.js.html +136 -0
- package/coverage/lcov-report/src/number/round.js.html +139 -0
- package/coverage/lcov-report/src/number/toPercentage.js.html +151 -0
- package/coverage/lcov-report/src/object/define.js.html +118 -0
- package/coverage/lcov-report/src/object/defineFrozen.js.html +106 -0
- package/coverage/lcov-report/src/object/defineSealed.js.html +106 -0
- package/coverage/lcov-report/src/object/forValues.js.html +133 -0
- package/coverage/lcov-report/src/object/index.html +236 -0
- package/coverage/lcov-report/src/object/is.js.html +100 -0
- package/coverage/lcov-report/src/object/isNotEmpty.js.html +109 -0
- package/coverage/lcov-report/src/object/merge.js.html +157 -0
- package/coverage/lcov-report/src/object/pick.js.html +151 -0
- package/coverage/lcov-report/src/object/zip.js.html +145 -0
- package/coverage/lcov-report/src/regexp/index.html +116 -0
- package/coverage/lcov-report/src/regexp/is.js.html +100 -0
- package/coverage/lcov-report/src/string/index.html +146 -0
- package/coverage/lcov-report/src/string/is.js.html +100 -0
- package/coverage/lcov-report/src/string/isBetween.js.html +133 -0
- package/coverage/lcov-report/src/string/isNotEmpty.js.html +109 -0
- package/coverage/lcov.info +1132 -0
- package/date/is.js +5 -4
- package/deep/define.js +8 -10
- package/deep/freeze.js +19 -25
- package/deep/get.js +29 -32
- package/deep/seal.js +19 -25
- package/deep/set.js +41 -42
- package/equal.js +44 -59
- package/function/is.js +5 -6
- package/function/noop.js +2 -3
- package/function/noopresolve.js +7 -8
- package/function/noopreturn.js +5 -6
- package/function/sleep.js +11 -17
- package/hash/fnv1A.js +38 -60
- package/hash/guid.js +22 -30
- package/is.js +110 -59
- package/number/is.js +8 -9
- package/number/isAbove.js +15 -0
- package/number/isBelow.js +15 -0
- package/number/isBetween.js +9 -12
- package/number/isNumericalNaN.js +5 -4
- package/number/randomBetween.js +16 -19
- package/number/round.js +16 -19
- package/number/toPercentage.js +21 -26
- package/object/define.js +12 -13
- package/object/defineFrozen.js +9 -11
- package/object/defineSealed.js +9 -11
- package/object/forValues.js +17 -22
- package/object/is.js +5 -4
- package/object/isNotEmpty.js +8 -9
- package/object/merge.js +21 -22
- package/object/pick.js +22 -29
- package/object/zip.js +19 -20
- package/package.json +15 -17
- package/regexp/is.js +5 -4
- package/string/is.js +5 -4
- package/string/isBetween.js +13 -20
- package/string/isNotEmpty.js +9 -11
- package/test/constants.js +0 -6
- package/test/src/array.test.js +38 -40
- package/test/src/boolean.test.js +18 -15
- package/test/src/caching.test.js +10 -1
- package/test/src/date.test.js +18 -15
- package/test/src/deep.test.js +155 -66
- package/test/src/equal.test.js +66 -57
- package/test/src/function.test.js +47 -45
- package/test/src/hash.test.js +39 -30
- package/test/src/is.test.js +68 -71
- package/test/src/number.test.js +351 -67
- package/test/src/object.test.js +129 -131
- package/test/src/regexp.test.js +18 -15
- package/test/src/string.test.js +59 -59
- package/formdata/is.js +0 -9
- package/karma.conf.js +0 -64
- package/test/src/formdata.test.js +0 -67
- package/test/test_index.js +0 -2
|
@@ -14,64 +14,68 @@ import {
|
|
|
14
14
|
fnDateValues,
|
|
15
15
|
fnArrayValues,
|
|
16
16
|
fnFunctionValues,
|
|
17
|
-
fnFormDataValues,
|
|
18
17
|
fnNullables,
|
|
19
18
|
} from '../constants';
|
|
20
19
|
|
|
20
|
+
const chai = require('chai');
|
|
21
|
+
const spies = require('chai-spies');
|
|
22
|
+
chai.use(spies);
|
|
23
|
+
|
|
24
|
+
const expect = chai.expect;
|
|
25
|
+
const assert = chai.assert;
|
|
26
|
+
const should = chai.should();
|
|
27
|
+
const spy = chai.spy;
|
|
28
|
+
|
|
21
29
|
describe("Function - isFunction", () => {
|
|
22
30
|
it ('not see a string as a function', () => {
|
|
23
31
|
let vals = fnStringValues();
|
|
24
|
-
for (let el of vals) expect(isFunction(el)).
|
|
32
|
+
for (let el of vals) expect(isFunction(el)).to.eql(false);
|
|
25
33
|
});
|
|
26
34
|
|
|
27
35
|
it ('not see a numeric value as a function', () => {
|
|
28
36
|
let vals = fnNumericValues();
|
|
29
|
-
for (let el of vals) expect(isFunction(el)).
|
|
37
|
+
for (let el of vals) expect(isFunction(el)).to.eql(false);
|
|
30
38
|
});
|
|
31
39
|
|
|
32
40
|
it ('not see a boolean as a function', () => {
|
|
33
41
|
let vals = fnBooleanValues();
|
|
34
|
-
for (let el of vals) expect(isFunction(el)).
|
|
42
|
+
for (let el of vals) expect(isFunction(el)).to.eql(false);
|
|
35
43
|
});
|
|
36
44
|
|
|
37
45
|
it ('not see a regex as a function', () => {
|
|
38
46
|
let vals = fnRegexValues();
|
|
39
|
-
for (let el of vals) expect(isFunction(el)).
|
|
47
|
+
for (let el of vals) expect(isFunction(el)).to.eql(false);
|
|
40
48
|
});
|
|
41
49
|
|
|
42
50
|
it ('not see an object as a function', () => {
|
|
43
51
|
let vals = fnObjectValues();
|
|
44
|
-
for (let el of vals) expect(isFunction(el)).
|
|
52
|
+
for (let el of vals) expect(isFunction(el)).to.eql(false);
|
|
45
53
|
});
|
|
46
54
|
|
|
47
55
|
it ('not see a nullable as a function', () => {
|
|
48
56
|
let vals = fnNullables();
|
|
49
|
-
for (let el of vals) expect(isFunction(el)).
|
|
57
|
+
for (let el of vals) expect(isFunction(el)).to.eql(false);
|
|
50
58
|
});
|
|
51
59
|
|
|
52
60
|
it ('not see a date as a function', () => {
|
|
53
61
|
let vals = fnDateValues();
|
|
54
|
-
for (let el of vals) expect(isFunction(el)).
|
|
62
|
+
for (let el of vals) expect(isFunction(el)).to.eql(false);
|
|
55
63
|
});
|
|
56
64
|
|
|
57
65
|
it ('not see an array as a function', () => {
|
|
58
66
|
let vals = fnArrayValues();
|
|
59
|
-
for (let el of vals) expect(isFunction(el)).
|
|
67
|
+
for (let el of vals) expect(isFunction(el)).to.eql(false);
|
|
60
68
|
});
|
|
61
69
|
|
|
62
70
|
it ('see a function as a function', () => {
|
|
63
71
|
let vals = fnFunctionValues();
|
|
64
|
-
for (let el of vals) expect(isFunction(el)).
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it ('not see formdata as a function', () => {
|
|
68
|
-
let vals = fnFormDataValues();
|
|
69
|
-
for (let el of vals) expect(isFunction(el)).toEqual(false);
|
|
72
|
+
for (let el of vals) expect(isFunction(el)).to.eql(true);
|
|
70
73
|
});
|
|
71
74
|
});
|
|
72
75
|
|
|
73
76
|
describe("Function - noop", () => {
|
|
74
77
|
let obj, rslt, thrown, var_a;
|
|
78
|
+
let spy_fn = false;
|
|
75
79
|
|
|
76
80
|
beforeEach(() => {
|
|
77
81
|
try {
|
|
@@ -80,8 +84,7 @@ describe("Function - noop", () => {
|
|
|
80
84
|
var_a = 42;
|
|
81
85
|
thrown = false;
|
|
82
86
|
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
spy_fn = spy(obj, 'fn');
|
|
85
88
|
rslt = obj.fn(var_a);
|
|
86
89
|
} catch (err) {
|
|
87
90
|
thrown = true;
|
|
@@ -89,24 +92,25 @@ describe("Function - noop", () => {
|
|
|
89
92
|
});
|
|
90
93
|
|
|
91
94
|
it ('execute the function when called', () => {
|
|
92
|
-
expect(
|
|
95
|
+
expect(spy_fn).to.have.been.called;
|
|
93
96
|
});
|
|
94
97
|
|
|
95
98
|
it ('return nothing', () => {
|
|
96
|
-
expect(rslt).
|
|
99
|
+
expect(rslt).to.eql(undefined);
|
|
97
100
|
});
|
|
98
101
|
|
|
99
102
|
it ('not affect parameters', () => {
|
|
100
|
-
expect(var_a).
|
|
103
|
+
expect(var_a).to.eql(42);
|
|
101
104
|
});
|
|
102
105
|
|
|
103
106
|
it ('not throw an error', () => {
|
|
104
|
-
expect(thrown).
|
|
107
|
+
expect(thrown).to.eql(false);
|
|
105
108
|
});
|
|
106
109
|
});
|
|
107
110
|
|
|
108
111
|
describe("Function - noopreturn", () => {
|
|
109
112
|
let obj, rslt, thrown, var_a;
|
|
113
|
+
let spy_fn = false;
|
|
110
114
|
|
|
111
115
|
beforeEach(() => {
|
|
112
116
|
try {
|
|
@@ -115,7 +119,7 @@ describe("Function - noopreturn", () => {
|
|
|
115
119
|
var_a = 42;
|
|
116
120
|
thrown = false;
|
|
117
121
|
|
|
118
|
-
|
|
122
|
+
spy_fn = spy(obj, 'fn');
|
|
119
123
|
rslt = obj.fn(var_a);
|
|
120
124
|
rslt = obj.fn(obj.fn(var_a));
|
|
121
125
|
} catch (err) {
|
|
@@ -124,33 +128,34 @@ describe("Function - noopreturn", () => {
|
|
|
124
128
|
});
|
|
125
129
|
|
|
126
130
|
it ('execute the function when called', () => {
|
|
127
|
-
expect(
|
|
131
|
+
expect(spy_fn).to.have.been.called;
|
|
128
132
|
});
|
|
129
133
|
|
|
130
134
|
it ('return passed variable', () => {
|
|
131
|
-
expect(rslt).
|
|
135
|
+
expect(rslt).to.eql(42);
|
|
132
136
|
});
|
|
133
137
|
|
|
134
138
|
it ('not affect parameters', () => {
|
|
135
|
-
expect(var_a).
|
|
139
|
+
expect(var_a).to.eql(42);
|
|
136
140
|
});
|
|
137
141
|
|
|
138
142
|
it ('not throw an error', () => {
|
|
139
|
-
expect(thrown).
|
|
143
|
+
expect(thrown).to.eql(false);
|
|
140
144
|
});
|
|
141
145
|
});
|
|
142
146
|
|
|
143
147
|
describe("Function - noopresolve", () => {
|
|
144
148
|
let obj, rslt, thrown, var_a;
|
|
149
|
+
let spy_fn = false;
|
|
145
150
|
|
|
146
151
|
beforeEach(() => {
|
|
147
152
|
try {
|
|
148
|
-
obj = {
|
|
153
|
+
obj = {fn : noopresolve};
|
|
149
154
|
rslt = undefined;
|
|
150
155
|
var_a = 42;
|
|
151
156
|
thrown = false;
|
|
152
157
|
|
|
153
|
-
|
|
158
|
+
spy_fn = spy(obj, 'fn');
|
|
154
159
|
rslt = obj.fn(var_a);
|
|
155
160
|
} catch (err) {
|
|
156
161
|
thrown = true;
|
|
@@ -158,56 +163,53 @@ describe("Function - noopresolve", () => {
|
|
|
158
163
|
});
|
|
159
164
|
|
|
160
165
|
it ('execute the function when called', () => {
|
|
161
|
-
expect(
|
|
166
|
+
expect(spy_fn).to.have.been.called;
|
|
162
167
|
});
|
|
163
168
|
|
|
164
169
|
it ('returns a promise', (next) => {
|
|
165
|
-
expect(rslt instanceof Promise).
|
|
170
|
+
expect(rslt instanceof Promise).to.eql(true);
|
|
166
171
|
next();
|
|
167
172
|
});
|
|
168
173
|
|
|
169
|
-
it ('returns a resolved promise', (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
).catch(
|
|
174
|
-
() => next(new Error('Promise should have resolved, instead it threw an error'))
|
|
175
|
-
);
|
|
174
|
+
it ('returns a resolved promise', async () => {
|
|
175
|
+
let is_resolved = false;
|
|
176
|
+
await rslt.then(() => is_resolved = true, () => {}).catch(() => {});
|
|
177
|
+
expect(is_resolved).to.eql(true);
|
|
176
178
|
});
|
|
177
179
|
|
|
178
180
|
it ('resolving the promise returns passed variable', (next) => {
|
|
179
181
|
rslt.then((value) => {
|
|
180
|
-
expect(value).
|
|
182
|
+
expect(value).to.eql(42);
|
|
181
183
|
next();
|
|
182
184
|
});
|
|
183
185
|
});
|
|
184
186
|
|
|
185
187
|
it ('not affect parameters', () => {
|
|
186
|
-
expect(var_a).
|
|
188
|
+
expect(var_a).to.eql(42);
|
|
187
189
|
});
|
|
188
190
|
|
|
189
191
|
it ('not throw an error', () => {
|
|
190
|
-
expect(thrown).
|
|
192
|
+
expect(thrown).to.eql(false);
|
|
191
193
|
});
|
|
192
194
|
});
|
|
193
195
|
|
|
194
196
|
describe("Function - sleep", () => {
|
|
195
197
|
it ('execute the function when called', async () => {
|
|
196
|
-
const o = {
|
|
197
|
-
|
|
198
|
+
const o = {fn: sleep};
|
|
199
|
+
const fn_spy = spy(o, 'fn');
|
|
198
200
|
await o.fn(0);
|
|
199
|
-
expect(
|
|
201
|
+
expect(fn_spy).to.have.been.called;
|
|
200
202
|
});
|
|
201
203
|
|
|
202
204
|
it ('returns a promise', () => {
|
|
203
205
|
const rslt = sleep();
|
|
204
|
-
expect(rslt instanceof Promise).
|
|
206
|
+
expect(rslt instanceof Promise).to.eql(true);
|
|
205
207
|
});
|
|
206
208
|
|
|
207
209
|
it ('resolves after the provided time', async () => {
|
|
208
210
|
const timer_start = new Date();
|
|
209
211
|
await sleep(200);
|
|
210
212
|
const timer_end = new Date() - timer_start;
|
|
211
|
-
expect(timer_end >= 200).
|
|
213
|
+
expect(timer_end >= 200).to.eql(true);
|
|
212
214
|
});
|
|
213
215
|
});
|
package/test/src/hash.test.js
CHANGED
|
@@ -3,20 +3,29 @@
|
|
|
3
3
|
import guid from '../../src/hash/guid';
|
|
4
4
|
import fnv1A from '../../src/hash/fnv1A';
|
|
5
5
|
|
|
6
|
+
const chai = require('chai');
|
|
7
|
+
const spies = require('chai-spies');
|
|
8
|
+
chai.use(spies);
|
|
9
|
+
|
|
10
|
+
const expect = chai.expect;
|
|
11
|
+
const assert = chai.assert;
|
|
12
|
+
const should = chai.should();
|
|
13
|
+
const spy = chai.spy;
|
|
14
|
+
|
|
6
15
|
describe("Hash - Guid", () => {
|
|
7
16
|
it ('output a string value', () => {
|
|
8
17
|
let g = guid();
|
|
9
|
-
|
|
18
|
+
assert.typeOf(g, 'string');
|
|
10
19
|
});
|
|
11
20
|
|
|
12
21
|
it ('have exactly 36 characters', () => {
|
|
13
22
|
let g = guid();
|
|
14
|
-
expect(g.length).
|
|
23
|
+
expect(g.length).to.eql(36);
|
|
15
24
|
});
|
|
16
25
|
|
|
17
26
|
it ('match the rfc4122 spec', () => {
|
|
18
27
|
let g = guid();
|
|
19
|
-
expect(/^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$/g.test(g)).
|
|
28
|
+
expect(/^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$/g.test(g)).to.eql(true);
|
|
20
29
|
});
|
|
21
30
|
|
|
22
31
|
it ('be unique (50.000 benchmark)', () => {
|
|
@@ -28,7 +37,7 @@ describe("Hash - Guid", () => {
|
|
|
28
37
|
cursor++;
|
|
29
38
|
}
|
|
30
39
|
|
|
31
|
-
expect(Object.keys(cache).length).
|
|
40
|
+
expect(Object.keys(cache).length).to.eql(cursor);
|
|
32
41
|
});
|
|
33
42
|
});
|
|
34
43
|
|
|
@@ -63,39 +72,39 @@ describe("Hash - FNV1A", () => {
|
|
|
63
72
|
const e_2 = fnv1A(new RegExp('abcdefg', 'i'));
|
|
64
73
|
const e_3 = fnv1A(new RegExp('abcdefg', 'ig'));
|
|
65
74
|
const e_4 = fnv1A(new RegExp('abcdefghij', 'i'));
|
|
66
|
-
expect(a_1).
|
|
67
|
-
expect(b_1).
|
|
68
|
-
expect(c_1).
|
|
69
|
-
expect(d_1).
|
|
70
|
-
expect(d_1 === d_3).
|
|
71
|
-
expect(e_1).
|
|
72
|
-
expect(e_1 === e_3).
|
|
73
|
-
expect(e_1 === e_4).
|
|
75
|
+
expect(a_1).to.eql(a_2);
|
|
76
|
+
expect(b_1).to.eql(b_2);
|
|
77
|
+
expect(c_1).to.eql(c_2);
|
|
78
|
+
expect(d_1).to.eql(d_2);
|
|
79
|
+
expect(d_1 === d_3).to.eql(false);
|
|
80
|
+
expect(e_1).to.eql(e_2);
|
|
81
|
+
expect(e_1 === e_3).to.eql(false);
|
|
82
|
+
expect(e_1 === e_4).to.eql(false);
|
|
74
83
|
});
|
|
75
84
|
|
|
76
85
|
it ('should throw a type error when passed an unhashable value', () => {
|
|
77
|
-
expect(function () { fnv1A(new Function()) }).
|
|
86
|
+
expect(function () { fnv1A(new Function()) }).to.throw(TypeError);
|
|
78
87
|
});
|
|
79
88
|
|
|
80
89
|
// Based on some tests available at : http://isthe.com/chongo/src/fnv/test_fnv.c
|
|
81
90
|
it ('should output values that equal the official spec (32 bit)', () => {
|
|
82
|
-
expect(fnv1A("")).
|
|
83
|
-
expect(fnv1A("a")).
|
|
84
|
-
expect(fnv1A("b")).
|
|
85
|
-
expect(fnv1A("c")).
|
|
86
|
-
expect(fnv1A("d")).
|
|
87
|
-
expect(fnv1A("e")).
|
|
88
|
-
expect(fnv1A("f")).
|
|
89
|
-
expect(fnv1A("fo")).
|
|
90
|
-
expect(fnv1A("foo")).
|
|
91
|
-
expect(fnv1A("foob")).
|
|
92
|
-
expect(fnv1A("fooba")).
|
|
93
|
-
expect(fnv1A("foobar")).
|
|
94
|
-
expect(fnv1A("64.81.78.84")).
|
|
95
|
-
expect(fnv1A("feedfacedaffdeed")).
|
|
96
|
-
expect(fnv1A("http://www.fourmilab.ch/gravitation/orbits/")).
|
|
97
|
-
expect(fnv1A("EFCDAB8967452301")).
|
|
98
|
-
expect(fnv1A("2^21701-1")).
|
|
91
|
+
expect(fnv1A("")).to.eql(0x811c9dc5);
|
|
92
|
+
expect(fnv1A("a")).to.eql(0xe40c292c);
|
|
93
|
+
expect(fnv1A("b")).to.eql(0xe70c2de5);
|
|
94
|
+
expect(fnv1A("c")).to.eql(0xe60c2c52);
|
|
95
|
+
expect(fnv1A("d")).to.eql(0xe10c2473);
|
|
96
|
+
expect(fnv1A("e")).to.eql(0xe00c22e0);
|
|
97
|
+
expect(fnv1A("f")).to.eql(0xe30c2799);
|
|
98
|
+
expect(fnv1A("fo")).to.eql(0x6222e842);
|
|
99
|
+
expect(fnv1A("foo")).to.eql(0xa9f37ed7);
|
|
100
|
+
expect(fnv1A("foob")).to.eql(0x3f5076ef);
|
|
101
|
+
expect(fnv1A("fooba")).to.eql(0x39aaa18a);
|
|
102
|
+
expect(fnv1A("foobar")).to.eql(0xbf9cf968);
|
|
103
|
+
expect(fnv1A("64.81.78.84")).to.eql(0xa55b89ed);
|
|
104
|
+
expect(fnv1A("feedfacedaffdeed")).to.eql(0xe83641e1);
|
|
105
|
+
expect(fnv1A("http://www.fourmilab.ch/gravitation/orbits/")).to.eql(0x29b50b38);
|
|
106
|
+
expect(fnv1A("EFCDAB8967452301")).to.eql(0x7fcb2275);
|
|
107
|
+
expect(fnv1A("2^21701-1")).to.eql(0xc0ed2114);
|
|
99
108
|
});
|
|
100
109
|
|
|
101
110
|
});
|
package/test/src/is.test.js
CHANGED
|
@@ -4,187 +4,184 @@ import Is from '../../src/is';
|
|
|
4
4
|
import isObject from '../../src/object/is';
|
|
5
5
|
import isFunction from '../../src/function/is';
|
|
6
6
|
|
|
7
|
+
const chai = require('chai');
|
|
8
|
+
const spies = require('chai-spies');
|
|
9
|
+
chai.use(spies);
|
|
10
|
+
|
|
11
|
+
const expect = chai.expect;
|
|
12
|
+
const assert = chai.assert;
|
|
13
|
+
const should = chai.should();
|
|
14
|
+
const spy = chai.spy;
|
|
15
|
+
|
|
7
16
|
describe("Is", () => {
|
|
8
17
|
|
|
9
18
|
it ('Should be an object', () => {
|
|
10
|
-
expect(isObject(Is)).
|
|
19
|
+
expect(isObject(Is)).to.eql(true);
|
|
11
20
|
});
|
|
12
21
|
|
|
13
22
|
it ('Should be a frozen object', () => {
|
|
14
|
-
expect(Object.isFrozen(Is)).
|
|
23
|
+
expect(Object.isFrozen(Is)).to.eql(true);
|
|
15
24
|
});
|
|
16
25
|
|
|
17
26
|
// Is.Array
|
|
18
27
|
|
|
19
28
|
it ('[fn-array] Should have an Array function', () => {
|
|
20
|
-
expect(isFunction(Is.Array)).
|
|
29
|
+
expect(isFunction(Is.Array)).to.eql(true);
|
|
21
30
|
});
|
|
22
31
|
|
|
23
32
|
it ('[fn-array] Should link to isArray', () => {
|
|
24
|
-
expect(Is.Array([])).
|
|
25
|
-
expect(Is.Array({})).
|
|
33
|
+
expect(Is.Array([])).to.eql(true);
|
|
34
|
+
expect(Is.Array({})).to.eql(false);
|
|
26
35
|
});
|
|
27
36
|
|
|
28
37
|
// Is.NotEmptyArray
|
|
29
38
|
|
|
30
39
|
it ('[fn-notemptyarray] Should have a NotEmptyArray function', () => {
|
|
31
|
-
expect(isFunction(Is.Array)).
|
|
40
|
+
expect(isFunction(Is.Array)).to.eql(true);
|
|
32
41
|
});
|
|
33
42
|
|
|
34
43
|
it ('[fn-notemptyarray] Should link to isNotEmptyArray', () => {
|
|
35
|
-
expect(Is.NotEmptyArray([1, 2, 3])).
|
|
36
|
-
expect(Is.NotEmptyArray([])).
|
|
37
|
-
expect(Is.NotEmptyArray({})).
|
|
44
|
+
expect(Is.NotEmptyArray([1, 2, 3])).to.eql(true);
|
|
45
|
+
expect(Is.NotEmptyArray([])).to.eql(false);
|
|
46
|
+
expect(Is.NotEmptyArray({})).to.eql(false);
|
|
38
47
|
});
|
|
39
48
|
|
|
40
49
|
// Is.Boolean
|
|
41
50
|
|
|
42
51
|
it ('[fn-boolean] Should have a Boolean function', () => {
|
|
43
|
-
expect(isFunction(Is.Boolean)).
|
|
52
|
+
expect(isFunction(Is.Boolean)).to.eql(true);
|
|
44
53
|
});
|
|
45
54
|
|
|
46
55
|
it ('[fn-boolean] Should link to isBoolean', () => {
|
|
47
|
-
expect(Is.Boolean([])).
|
|
48
|
-
expect(Is.Boolean(false)).
|
|
49
|
-
expect(Is.Boolean(true)).
|
|
56
|
+
expect(Is.Boolean([])).to.eql(false);
|
|
57
|
+
expect(Is.Boolean(false)).to.eql(true);
|
|
58
|
+
expect(Is.Boolean(true)).to.eql(true);
|
|
50
59
|
});
|
|
51
60
|
|
|
52
61
|
// Is.Date
|
|
53
62
|
|
|
54
63
|
it ('[fn-date] Should have a Date function', () => {
|
|
55
|
-
expect(isFunction(Is.Date)).
|
|
64
|
+
expect(isFunction(Is.Date)).to.eql(true);
|
|
56
65
|
});
|
|
57
66
|
|
|
58
67
|
it ('[fn-date] Should link to isDate', () => {
|
|
59
|
-
expect(Is.Date([1, 2, 3])).
|
|
60
|
-
expect(Is.Date('2021-01-01')).
|
|
61
|
-
expect(Is.Date(new Date())).
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// Is.FormData
|
|
65
|
-
|
|
66
|
-
it ('[fn-formdata] Should have a FormData function', () => {
|
|
67
|
-
expect(isFunction(Is.FormData)).toEqual(true);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it ('[fn-formdata] Should link to isFormData', () => {
|
|
71
|
-
expect(Is.FormData([1, 2, 3])).toEqual(false);
|
|
72
|
-
expect(Is.FormData('2021-01-01')).toEqual(false);
|
|
73
|
-
expect(Is.FormData(new FormData())).toEqual(true);
|
|
68
|
+
expect(Is.Date([1, 2, 3])).to.eql(false);
|
|
69
|
+
expect(Is.Date('2021-01-01')).to.eql(false);
|
|
70
|
+
expect(Is.Date(new Date())).to.eql(true);
|
|
74
71
|
});
|
|
75
72
|
|
|
76
73
|
// Is.Function
|
|
77
74
|
|
|
78
75
|
it ('[fn-function] Should have a Function function', () => {
|
|
79
|
-
expect(isFunction(Is.Function)).
|
|
76
|
+
expect(isFunction(Is.Function)).to.eql(true);
|
|
80
77
|
});
|
|
81
78
|
|
|
82
79
|
it ('[fn-function] Should link to isFunction', () => {
|
|
83
|
-
expect(Is.Function([1, 2, 3])).
|
|
84
|
-
expect(Is.Function('2021-01-01')).
|
|
85
|
-
expect(Is.Function(() => {})).
|
|
80
|
+
expect(Is.Function([1, 2, 3])).to.eql(false);
|
|
81
|
+
expect(Is.Function('2021-01-01')).to.eql(false);
|
|
82
|
+
expect(Is.Function(() => {})).to.eql(true);
|
|
86
83
|
});
|
|
87
84
|
|
|
88
85
|
// Is.Number
|
|
89
86
|
|
|
90
87
|
it ('[fn-number] Should have a Number function', () => {
|
|
91
|
-
expect(isFunction(Is.Number)).
|
|
88
|
+
expect(isFunction(Is.Number)).to.eql(true);
|
|
92
89
|
});
|
|
93
90
|
|
|
94
91
|
it ('[fn-number] Should link to isNumber', () => {
|
|
95
|
-
expect(Is.Number([1, 2, 3])).
|
|
96
|
-
expect(Is.Number('2021-01-01')).
|
|
97
|
-
expect(Is.Number(1)).
|
|
92
|
+
expect(Is.Number([1, 2, 3])).to.eql(false);
|
|
93
|
+
expect(Is.Number('2021-01-01')).to.eql(false);
|
|
94
|
+
expect(Is.Number(1)).to.eql(true);
|
|
98
95
|
});
|
|
99
96
|
|
|
100
97
|
// Is.NumberBetween
|
|
101
98
|
|
|
102
99
|
it ('[fn-numberbetween] Should have a NumberBetween function', () => {
|
|
103
|
-
expect(isFunction(Is.NumberBetween)).
|
|
100
|
+
expect(isFunction(Is.NumberBetween)).to.eql(true);
|
|
104
101
|
});
|
|
105
102
|
|
|
106
103
|
it ('[fn-numberbetween] Should link to isNumberBetween', () => {
|
|
107
|
-
expect(Is.NumberBetween(1, 0, 2)).
|
|
108
|
-
expect(Is.NumberBetween(10, 10, 11)).
|
|
109
|
-
expect(Is.NumberBetween(50, 10, 30)).
|
|
110
|
-
expect(Is.NumberBetween('a', 2, 6)).
|
|
111
|
-
expect(Is.NumberBetween({})).
|
|
104
|
+
expect(Is.NumberBetween(1, 0, 2)).to.eql(true);
|
|
105
|
+
expect(Is.NumberBetween(10, 10, 11)).to.eql(true);
|
|
106
|
+
expect(Is.NumberBetween(50, 10, 30)).to.eql(false);
|
|
107
|
+
expect(Is.NumberBetween('a', 2, 6)).to.eql(false);
|
|
108
|
+
expect(Is.NumberBetween({})).to.eql(false);
|
|
112
109
|
});
|
|
113
110
|
|
|
114
111
|
// Is.RegExp
|
|
115
112
|
|
|
116
113
|
it ('[fn-regexp] Should have a RegExp function', () => {
|
|
117
|
-
expect(isFunction(Is.RegExp)).
|
|
114
|
+
expect(isFunction(Is.RegExp)).to.eql(true);
|
|
118
115
|
});
|
|
119
116
|
|
|
120
117
|
it ('[fn-regexp] Should link to isRegExp', () => {
|
|
121
|
-
expect(Is.RegExp([1, 2, 3])).
|
|
122
|
-
expect(Is.RegExp('2021-01-01')).
|
|
123
|
-
expect(Is.RegExp(/hi/g)).
|
|
118
|
+
expect(Is.RegExp([1, 2, 3])).to.eql(false);
|
|
119
|
+
expect(Is.RegExp('2021-01-01')).to.eql(false);
|
|
120
|
+
expect(Is.RegExp(/hi/g)).to.eql(true);
|
|
124
121
|
});
|
|
125
122
|
|
|
126
123
|
// Is.Object
|
|
127
124
|
|
|
128
125
|
it ('[fn-object] Should have an Object function', () => {
|
|
129
|
-
expect(isFunction(Is.Object)).
|
|
126
|
+
expect(isFunction(Is.Object)).to.eql(true);
|
|
130
127
|
});
|
|
131
128
|
|
|
132
129
|
it ('[fn-object] Should link to isObject', () => {
|
|
133
|
-
expect(Is.Object([1, 2, 3])).
|
|
134
|
-
expect(Is.Object('2021-01-01')).
|
|
135
|
-
expect(Is.Object({a:1})).
|
|
130
|
+
expect(Is.Object([1, 2, 3])).to.eql(false);
|
|
131
|
+
expect(Is.Object('2021-01-01')).to.eql(false);
|
|
132
|
+
expect(Is.Object({a:1})).to.eql(true);
|
|
136
133
|
});
|
|
137
134
|
|
|
138
135
|
// Is.NotEmptyObject
|
|
139
136
|
|
|
140
137
|
it ('[fn-notemptyobject] Should have an NotEmptyObject function', () => {
|
|
141
|
-
expect(isFunction(Is.NotEmptyObject)).
|
|
138
|
+
expect(isFunction(Is.NotEmptyObject)).to.eql(true);
|
|
142
139
|
});
|
|
143
140
|
|
|
144
141
|
it ('[fn-notemptyobject] Should link to isNotEmptyObject', () => {
|
|
145
|
-
expect(Is.NotEmptyObject([1, 2, 3])).
|
|
146
|
-
expect(Is.NotEmptyObject('2021-01-01')).
|
|
147
|
-
expect(Is.NotEmptyObject({a:1})).
|
|
148
|
-
expect(Is.NotEmptyObject({})).
|
|
142
|
+
expect(Is.NotEmptyObject([1, 2, 3])).to.eql(false);
|
|
143
|
+
expect(Is.NotEmptyObject('2021-01-01')).to.eql(false);
|
|
144
|
+
expect(Is.NotEmptyObject({a:1})).to.eql(true);
|
|
145
|
+
expect(Is.NotEmptyObject({})).to.eql(false);
|
|
149
146
|
});
|
|
150
147
|
|
|
151
148
|
// Is.String
|
|
152
149
|
|
|
153
150
|
it ('[fn-string] Should have a String function', () => {
|
|
154
|
-
expect(isFunction(Is.String)).
|
|
151
|
+
expect(isFunction(Is.String)).to.eql(true);
|
|
155
152
|
});
|
|
156
153
|
|
|
157
154
|
it ('[fn-string] Should link to isString', () => {
|
|
158
|
-
expect(Is.String([1, 2, 3])).
|
|
159
|
-
expect(Is.String('2021-01-01')).
|
|
160
|
-
expect(Is.String({a:1})).
|
|
155
|
+
expect(Is.String([1, 2, 3])).to.eql(false);
|
|
156
|
+
expect(Is.String('2021-01-01')).to.eql(true);
|
|
157
|
+
expect(Is.String({a:1})).to.eql(false);
|
|
161
158
|
});
|
|
162
159
|
|
|
163
160
|
// Is.StringBetween
|
|
164
161
|
|
|
165
162
|
it ('[fn-stringbetween] Should have a StringBetween function', () => {
|
|
166
|
-
expect(isFunction(Is.StringBetween)).
|
|
163
|
+
expect(isFunction(Is.StringBetween)).to.eql(true);
|
|
167
164
|
});
|
|
168
165
|
|
|
169
166
|
it ('[fn-stringbetween] Should link to isStringBetween', () => {
|
|
170
|
-
expect(Is.StringBetween([1, 2, 3])).
|
|
171
|
-
expect(Is.StringBetween('2021-01-01', 0, 10)).
|
|
172
|
-
expect(Is.StringBetween('a', 2, 6)).
|
|
173
|
-
expect(Is.StringBetween({})).
|
|
167
|
+
expect(Is.StringBetween([1, 2, 3])).to.eql(false);
|
|
168
|
+
expect(Is.StringBetween('2021-01-01', 0, 10)).to.eql(true);
|
|
169
|
+
expect(Is.StringBetween('a', 2, 6)).to.eql(false);
|
|
170
|
+
expect(Is.StringBetween({})).to.eql(false);
|
|
174
171
|
});
|
|
175
172
|
|
|
176
173
|
// Is.NotEmptyString
|
|
177
174
|
|
|
178
175
|
it ('[fn-notemptystring] Should have an NotEmptyString function', () => {
|
|
179
|
-
expect(isFunction(Is.NotEmptyString)).
|
|
176
|
+
expect(isFunction(Is.NotEmptyString)).to.eql(true);
|
|
180
177
|
});
|
|
181
178
|
|
|
182
179
|
it ('[fn-notemptystring] Should link to isNotEmptyString', () => {
|
|
183
|
-
expect(Is.NotEmptyString([1, 2, 3])).
|
|
184
|
-
expect(Is.NotEmptyString('2021-01-01')).
|
|
185
|
-
expect(Is.NotEmptyString('')).
|
|
186
|
-
expect(Is.NotEmptyString({a:1})).
|
|
187
|
-
expect(Is.NotEmptyString({})).
|
|
180
|
+
expect(Is.NotEmptyString([1, 2, 3])).to.eql(false);
|
|
181
|
+
expect(Is.NotEmptyString('2021-01-01')).to.eql(true);
|
|
182
|
+
expect(Is.NotEmptyString('')).to.eql(false);
|
|
183
|
+
expect(Is.NotEmptyString({a:1})).to.eql(false);
|
|
184
|
+
expect(Is.NotEmptyString({})).to.eql(false);
|
|
188
185
|
});
|
|
189
186
|
|
|
190
187
|
});
|