@aryth/bound-vector
Advanced tools
Comparing version 0.2.13 to 0.2.14
@@ -7,5 +7,5 @@ 'use strict'; | ||
var enumCheckLevels = require('@typen/enum-check-levels'); | ||
var stringValue = require('@spare/string-value'); | ||
var literal = require('@typen/literal'); | ||
var numStrict = require('@typen/num-strict'); | ||
var stringValue$1 = require('@spare/string-value'); | ||
@@ -60,26 +60,2 @@ const iniNumEntry = (ar, lo, hi, { | ||
const STR = 'string'; | ||
const v1 = word => (word.toLowerCase() & 0x7f) << 21; | ||
const v2 = word => (((word = word.toLowerCase()) & 0x7f) << 21) + ((word.charCodeAt(1) & 0x7f) << 14); | ||
const v3 = word => (((word = word.toLowerCase()).charCodeAt(0) & 0x7f) << 21) + ((word.charCodeAt(1) & 0x7f) << 14) + ((word.charCodeAt(2) & 0x7f) << 7); | ||
const v4 = word => (((word = word.toLowerCase()).charCodeAt(0) & 0x7f) << 21) + ((word.charCodeAt(1) & 0x7f) << 14) + ((word.charCodeAt(2) & 0x7f) << 7) + (word.charCodeAt(3) & 0x7f); | ||
const stringValue = word => { | ||
const l = word === null || word === void 0 ? void 0 : word.length; | ||
if (!l) return NaN; | ||
if (typeof word !== STR) return NaN; | ||
if (l >= 8) return (v4(word.slice(0, 4)) << 2) + v4(word.slice(-4)); | ||
if (l === 7) return (v4(word.slice(0, 4)) << 2) + v3(word.slice(-3)); | ||
if (l === 6) return (v4(word.slice(0, 4)) << 2) + v2(word.slice(-2)); | ||
if (l === 5) return (v4(word.slice(0, 4)) << 2) + v1(word.slice(-1)); | ||
if (l === 4) return v4(word) << 2; | ||
if (l === 3) return v3(word) << 2; | ||
if (l === 2) return v2(word) << 2; | ||
if (l === 1) return v1(word) << 2; | ||
}; | ||
const iterate = function (vec, fn, l) { | ||
@@ -123,3 +99,3 @@ l = l || vec && vec.length; | ||
const filterY = (_optY$filter = optY === null || optY === void 0 ? void 0 : optY.filter) !== null && _optY$filter !== void 0 ? _optY$filter : literal.hasLiteral, | ||
mapY = (_optY$mapper = optY === null || optY === void 0 ? void 0 : optY.mapper) !== null && _optY$mapper !== void 0 ? _optY$mapper : stringValue; | ||
mapY = (_optY$mapper = optY === null || optY === void 0 ? void 0 : optY.mapper) !== null && _optY$mapper !== void 0 ? _optY$mapper : stringValue.stringValue; | ||
iterate(words, (v, i) => { | ||
@@ -185,3 +161,3 @@ var _veX, _veY; | ||
const filter = (_opt$filter = opt === null || opt === void 0 ? void 0 : opt.filter) !== null && _opt$filter !== void 0 ? _opt$filter : literal.hasLiteral, | ||
mapper = (_opt$mapper = opt === null || opt === void 0 ? void 0 : opt.mapper) !== null && _opt$mapper !== void 0 ? _opt$mapper : stringValue$1.stringValue; | ||
mapper = (_opt$mapper = opt === null || opt === void 0 ? void 0 : opt.mapper) !== null && _opt$mapper !== void 0 ? _opt$mapper : stringValue.stringValue; | ||
iterate(words, (v, i) => { | ||
@@ -188,0 +164,0 @@ var _vec; |
import { IsNum, boundOutput, ToNum } from '@aryth/util-bound'; | ||
import { LOOSE } from '@typen/enum-check-levels'; | ||
import { stringValue } from '@spare/string-value'; | ||
import { hasLiteral } from '@typen/literal'; | ||
import { isNumeric } from '@typen/num-strict'; | ||
import { stringValue as stringValue$1 } from '@spare/string-value'; | ||
@@ -55,26 +55,2 @@ const iniNumEntry = (ar, lo, hi, { | ||
const STR = 'string'; | ||
const v1 = word => (word.toLowerCase() & 0x7f) << 21; | ||
const v2 = word => (((word = word.toLowerCase()) & 0x7f) << 21) + ((word.charCodeAt(1) & 0x7f) << 14); | ||
const v3 = word => (((word = word.toLowerCase()).charCodeAt(0) & 0x7f) << 21) + ((word.charCodeAt(1) & 0x7f) << 14) + ((word.charCodeAt(2) & 0x7f) << 7); | ||
const v4 = word => (((word = word.toLowerCase()).charCodeAt(0) & 0x7f) << 21) + ((word.charCodeAt(1) & 0x7f) << 14) + ((word.charCodeAt(2) & 0x7f) << 7) + (word.charCodeAt(3) & 0x7f); | ||
const stringValue = word => { | ||
const l = word === null || word === void 0 ? void 0 : word.length; | ||
if (!l) return NaN; | ||
if (typeof word !== STR) return NaN; | ||
if (l >= 8) return (v4(word.slice(0, 4)) << 2) + v4(word.slice(-4)); | ||
if (l === 7) return (v4(word.slice(0, 4)) << 2) + v3(word.slice(-3)); | ||
if (l === 6) return (v4(word.slice(0, 4)) << 2) + v2(word.slice(-2)); | ||
if (l === 5) return (v4(word.slice(0, 4)) << 2) + v1(word.slice(-1)); | ||
if (l === 4) return v4(word) << 2; | ||
if (l === 3) return v3(word) << 2; | ||
if (l === 2) return v2(word) << 2; | ||
if (l === 1) return v1(word) << 2; | ||
}; | ||
const iterate = function (vec, fn, l) { | ||
@@ -179,3 +155,3 @@ l = l || vec && vec.length; | ||
const filter = (_opt$filter = opt === null || opt === void 0 ? void 0 : opt.filter) !== null && _opt$filter !== void 0 ? _opt$filter : hasLiteral, | ||
mapper = (_opt$mapper = opt === null || opt === void 0 ? void 0 : opt.mapper) !== null && _opt$mapper !== void 0 ? _opt$mapper : stringValue$1; | ||
mapper = (_opt$mapper = opt === null || opt === void 0 ? void 0 : opt.mapper) !== null && _opt$mapper !== void 0 ? _opt$mapper : stringValue; | ||
iterate(words, (v, i) => { | ||
@@ -182,0 +158,0 @@ var _vec; |
{ | ||
"name": "@aryth/bound-vector", | ||
"version": "0.2.13", | ||
"version": "0.2.14", | ||
"description": "A math util library", | ||
@@ -18,3 +18,3 @@ "main": "dist/index.cjs.js", | ||
"dependencies": { | ||
"@aryth/util-bound": "^0.2.13", | ||
"@aryth/util-bound": "^0.2.14", | ||
"@ject/oneself": "^0.0.6", | ||
@@ -41,3 +41,3 @@ "@spare/string-value": "^0.8.8", | ||
"homepage": "https://github.com/hoyeungw/aryth#readme", | ||
"gitHead": "c37dfba437fc1ebc45ede73fe95a047ae069abd5" | ||
"gitHead": "e6c03af3271cc7b45aa029eedda5ab2d9fdf71e6" | ||
} |
13793
291
Updated@aryth/util-bound@^0.2.14