@aryth/bound-vector
Advanced tools
Comparing version 0.3.19 to 0.3.20
@@ -26,3 +26,3 @@ 'use strict'; | ||
/** @type {{dif: boolean, level: number}} */ | ||
const config = this !== null && this !== void 0 ? this : { | ||
const config = this ?? { | ||
dif: true, | ||
@@ -33,3 +33,3 @@ level: enumCheckLevels.LOOSE | ||
toNum = utilBound.ToNum(config.level); | ||
let l = vec === null || vec === void 0 ? void 0 : vec.length; | ||
let l = vec == null ? void 0 : vec.length; | ||
if (!l) return toOutput(NaN, NaN); | ||
@@ -76,3 +76,3 @@ let [i, x] = iniNumEntry(vec, 0, l, config); | ||
const duobound = function (words, [configX, configY] = []) { | ||
const l = words === null || words === void 0 ? void 0 : words.length; | ||
const l = words == null ? void 0 : words.length; | ||
let vecX = undefined, | ||
@@ -90,10 +90,6 @@ vecY = undefined; | ||
iterate(words, (v, i) => { | ||
var _vecX, _vecY; | ||
if (filterX(v) && ((_vecX = vecX) !== null && _vecX !== void 0 ? _vecX : vecX = Array(l))) { | ||
var _vecX$max; | ||
if (filterX(v) && (vecX ?? (vecX = Array(l)))) { | ||
v = mapperX(v); | ||
if (v > ((_vecX$max = vecX.max) !== null && _vecX$max !== void 0 ? _vecX$max : vecX.max = vecX.min = v)) { | ||
if (v > (vecX.max ?? (vecX.max = vecX.min = v))) { | ||
vecX.max = v; | ||
@@ -107,8 +103,6 @@ } else if (v < vecX.min) { | ||
if (filterY(v) && ((_vecY = vecY) !== null && _vecY !== void 0 ? _vecY : vecY = Array(l))) { | ||
var _vecY$max; | ||
if (filterY(v) && (vecY ?? (vecY = Array(l)))) { | ||
v = mapperY(v); | ||
if (v > ((_vecY$max = vecY.max) !== null && _vecY$max !== void 0 ? _vecY$max : vecY.max = vecY.min = v)) { | ||
if (v > (vecY.max ?? (vecY.max = vecY.min = v))) { | ||
vecY.max = v; | ||
@@ -143,3 +137,3 @@ } else if (v < vecY.min) { | ||
const solebound = function (words, config) { | ||
const l = words === null || words === void 0 ? void 0 : words.length; | ||
const l = words == null ? void 0 : words.length; | ||
let vec = undefined; | ||
@@ -153,10 +147,6 @@ if (!l) return vec; | ||
iterate(words, (v, i) => { | ||
var _vec; | ||
if (filter(v) && ((_vec = vec) !== null && _vec !== void 0 ? _vec : vec = Array(l))) { | ||
var _vec$max; | ||
if (filter(v) && (vec ?? (vec = Array(l)))) { | ||
v = mapper(v); | ||
if (v > ((_vec$max = vec.max) !== null && _vec$max !== void 0 ? _vec$max : vec.max = vec.min = v)) { | ||
if (v > (vec.max ?? (vec.max = vec.min = v))) { | ||
vec.max = v; | ||
@@ -191,3 +181,3 @@ } else if (v < vec.min) { | ||
const multibound = function (words, configs) { | ||
const l = words === null || words === void 0 ? void 0 : words.length; | ||
const l = words == null ? void 0 : words.length; | ||
const vectorCollection = configs.map(x => undefined); | ||
@@ -199,12 +189,8 @@ if (!l) return vectorCollection; | ||
}, j) => { | ||
var _vec; | ||
let vec = vectorCollection[j]; | ||
if (filter(v) && ((_vec = vec) !== null && _vec !== void 0 ? _vec : vec = vectorCollection[j] = Array(l))) { | ||
var _vec$max; | ||
if (filter(v) && (vec ?? (vec = vectorCollection[j] = Array(l)))) { | ||
v = mapper(v); | ||
if (v > ((_vec$max = vec.max) !== null && _vec$max !== void 0 ? _vec$max : vec.max = vec.min = v)) { | ||
if (v > (vec.max ?? (vec.max = vec.min = v))) { | ||
vec.max = v; | ||
@@ -241,6 +227,4 @@ } else if (v < vec.min) { | ||
if (count === 1) { | ||
var _x$filter, _x$mapper; | ||
const [x = {}] = configs; | ||
x.filter = (_x$filter = x === null || x === void 0 ? void 0 : x.filter) !== null && _x$filter !== void 0 ? _x$filter : numeral.isNumeric, x.mapper = (_x$mapper = x === null || x === void 0 ? void 0 : x.mapper) !== null && _x$mapper !== void 0 ? _x$mapper : numeral.parseNum; | ||
x.filter = (x == null ? void 0 : x.filter) ?? numeral.isNumeric, x.mapper = (x == null ? void 0 : x.mapper) ?? numeral.parseNum; | ||
return [solebound(words, configs[0])]; | ||
@@ -250,9 +234,7 @@ } | ||
if (count === 2) { | ||
var _x$filter2, _x$mapper2, _y$filter, _y$mapper; | ||
const [x, y] = configs; | ||
const fX = (_x$filter2 = x === null || x === void 0 ? void 0 : x.filter) !== null && _x$filter2 !== void 0 ? _x$filter2 : numeral.isNumeric, | ||
mX = (_x$mapper2 = x === null || x === void 0 ? void 0 : x.mapper) !== null && _x$mapper2 !== void 0 ? _x$mapper2 : numeral.parseNum; | ||
const fY = (_y$filter = y === null || y === void 0 ? void 0 : y.filter) !== null && _y$filter !== void 0 ? _y$filter : literal.hasLiteral, | ||
mY = (_y$mapper = y === null || y === void 0 ? void 0 : y.mapper) !== null && _y$mapper !== void 0 ? _y$mapper : stringValue.stringValue; | ||
const fX = (x == null ? void 0 : x.filter) ?? numeral.isNumeric, | ||
mX = (x == null ? void 0 : x.mapper) ?? numeral.parseNum; | ||
const fY = (y == null ? void 0 : y.filter) ?? literal.hasLiteral, | ||
mY = (y == null ? void 0 : y.mapper) ?? stringValue.stringValue; | ||
return duobound(words, [{ | ||
@@ -259,0 +241,0 @@ filter: fX, |
@@ -22,3 +22,3 @@ import { IsNum, boundOutput, ToNum } from '@aryth/util-bound'; | ||
/** @type {{dif: boolean, level: number}} */ | ||
const config = this !== null && this !== void 0 ? this : { | ||
const config = this ?? { | ||
dif: true, | ||
@@ -29,3 +29,3 @@ level: LOOSE | ||
toNum = ToNum(config.level); | ||
let l = vec === null || vec === void 0 ? void 0 : vec.length; | ||
let l = vec == null ? void 0 : vec.length; | ||
if (!l) return toOutput(NaN, NaN); | ||
@@ -72,3 +72,3 @@ let [i, x] = iniNumEntry(vec, 0, l, config); | ||
const duobound = function (words, [configX, configY] = []) { | ||
const l = words === null || words === void 0 ? void 0 : words.length; | ||
const l = words == null ? void 0 : words.length; | ||
let vecX = undefined, | ||
@@ -86,10 +86,6 @@ vecY = undefined; | ||
iterate(words, (v, i) => { | ||
var _vecX, _vecY; | ||
if (filterX(v) && ((_vecX = vecX) !== null && _vecX !== void 0 ? _vecX : vecX = Array(l))) { | ||
var _vecX$max; | ||
if (filterX(v) && (vecX ?? (vecX = Array(l)))) { | ||
v = mapperX(v); | ||
if (v > ((_vecX$max = vecX.max) !== null && _vecX$max !== void 0 ? _vecX$max : vecX.max = vecX.min = v)) { | ||
if (v > (vecX.max ?? (vecX.max = vecX.min = v))) { | ||
vecX.max = v; | ||
@@ -103,8 +99,6 @@ } else if (v < vecX.min) { | ||
if (filterY(v) && ((_vecY = vecY) !== null && _vecY !== void 0 ? _vecY : vecY = Array(l))) { | ||
var _vecY$max; | ||
if (filterY(v) && (vecY ?? (vecY = Array(l)))) { | ||
v = mapperY(v); | ||
if (v > ((_vecY$max = vecY.max) !== null && _vecY$max !== void 0 ? _vecY$max : vecY.max = vecY.min = v)) { | ||
if (v > (vecY.max ?? (vecY.max = vecY.min = v))) { | ||
vecY.max = v; | ||
@@ -139,3 +133,3 @@ } else if (v < vecY.min) { | ||
const solebound = function (words, config) { | ||
const l = words === null || words === void 0 ? void 0 : words.length; | ||
const l = words == null ? void 0 : words.length; | ||
let vec = undefined; | ||
@@ -149,10 +143,6 @@ if (!l) return vec; | ||
iterate(words, (v, i) => { | ||
var _vec; | ||
if (filter(v) && ((_vec = vec) !== null && _vec !== void 0 ? _vec : vec = Array(l))) { | ||
var _vec$max; | ||
if (filter(v) && (vec ?? (vec = Array(l)))) { | ||
v = mapper(v); | ||
if (v > ((_vec$max = vec.max) !== null && _vec$max !== void 0 ? _vec$max : vec.max = vec.min = v)) { | ||
if (v > (vec.max ?? (vec.max = vec.min = v))) { | ||
vec.max = v; | ||
@@ -187,3 +177,3 @@ } else if (v < vec.min) { | ||
const multibound = function (words, configs) { | ||
const l = words === null || words === void 0 ? void 0 : words.length; | ||
const l = words == null ? void 0 : words.length; | ||
const vectorCollection = configs.map(x => undefined); | ||
@@ -195,12 +185,8 @@ if (!l) return vectorCollection; | ||
}, j) => { | ||
var _vec; | ||
let vec = vectorCollection[j]; | ||
if (filter(v) && ((_vec = vec) !== null && _vec !== void 0 ? _vec : vec = vectorCollection[j] = Array(l))) { | ||
var _vec$max; | ||
if (filter(v) && (vec ?? (vec = vectorCollection[j] = Array(l)))) { | ||
v = mapper(v); | ||
if (v > ((_vec$max = vec.max) !== null && _vec$max !== void 0 ? _vec$max : vec.max = vec.min = v)) { | ||
if (v > (vec.max ?? (vec.max = vec.min = v))) { | ||
vec.max = v; | ||
@@ -237,6 +223,4 @@ } else if (v < vec.min) { | ||
if (count === 1) { | ||
var _x$filter, _x$mapper; | ||
const [x = {}] = configs; | ||
x.filter = (_x$filter = x === null || x === void 0 ? void 0 : x.filter) !== null && _x$filter !== void 0 ? _x$filter : isNumeric, x.mapper = (_x$mapper = x === null || x === void 0 ? void 0 : x.mapper) !== null && _x$mapper !== void 0 ? _x$mapper : parseNum; | ||
x.filter = (x == null ? void 0 : x.filter) ?? isNumeric, x.mapper = (x == null ? void 0 : x.mapper) ?? parseNum; | ||
return [solebound(words, configs[0])]; | ||
@@ -246,9 +230,7 @@ } | ||
if (count === 2) { | ||
var _x$filter2, _x$mapper2, _y$filter, _y$mapper; | ||
const [x, y] = configs; | ||
const fX = (_x$filter2 = x === null || x === void 0 ? void 0 : x.filter) !== null && _x$filter2 !== void 0 ? _x$filter2 : isNumeric, | ||
mX = (_x$mapper2 = x === null || x === void 0 ? void 0 : x.mapper) !== null && _x$mapper2 !== void 0 ? _x$mapper2 : parseNum; | ||
const fY = (_y$filter = y === null || y === void 0 ? void 0 : y.filter) !== null && _y$filter !== void 0 ? _y$filter : hasLiteral, | ||
mY = (_y$mapper = y === null || y === void 0 ? void 0 : y.mapper) !== null && _y$mapper !== void 0 ? _y$mapper : stringValue; | ||
const fX = (x == null ? void 0 : x.filter) ?? isNumeric, | ||
mX = (x == null ? void 0 : x.mapper) ?? parseNum; | ||
const fY = (y == null ? void 0 : y.filter) ?? hasLiteral, | ||
mY = (y == null ? void 0 : y.mapper) ?? stringValue; | ||
return duobound(words, [{ | ||
@@ -255,0 +237,0 @@ filter: fX, |
{ | ||
"name": "@aryth/bound-vector", | ||
"version": "0.3.19", | ||
"version": "0.3.20", | ||
"description": "A math util library", | ||
@@ -18,5 +18,5 @@ "main": "dist/index.cjs.js", | ||
"dependencies": { | ||
"@aryth/util-bound": "^0.3.19", | ||
"@ject/oneself": "^0.0.11", | ||
"@texting/string-value": "^0.0.9", | ||
"@aryth/util-bound": "^0.3.20", | ||
"@ject/oneself": "^0.0.12", | ||
"@texting/string-value": "^0.0.10", | ||
"@typen/enum-check-levels": "^0.1.16", | ||
@@ -41,3 +41,3 @@ "@typen/literal": "^0.1.16", | ||
"homepage": "https://github.com/hoyeungw/aryth#readme", | ||
"gitHead": "577f88905f3e56b09bdd5680ecc8d91d68697931" | ||
"gitHead": "227c4f9de2905851b0b403453942fe4c3a3ea01a" | ||
} |
14820
413
+ Added@ject/oneself@0.0.12(transitive)
+ Added@texting/string-value@0.0.10(transitive)
- Removed@ject/oneself@0.0.11(transitive)
- Removed@texting/string-value@0.0.9(transitive)
Updated@aryth/util-bound@^0.3.20
Updated@ject/oneself@^0.0.12