New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aryth/bound-matrix

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aryth/bound-matrix - npm Package Compare versions

Comparing version 0.3.7 to 0.3.10

99

dist/index.cjs.js

@@ -77,44 +77,44 @@ 'use strict';

const duobound = (wordx, [configX = {}, configY = {}] = []) => {
const duobound = (wordx, [configX, configY] = []) => {
const [h, w] = matrixSize.size(wordx);
/** @type {?BoundedMatrix} */
let dtX = undefined;
/** @type {?BoundedMatrix} */
let dtY = undefined;
if (!h || !w) return [dtX, dtY];
const filterX = configX.filter,
mapperX = configX.mapper;
const filterY = configY.filter,
mapperY = configY.mapper;
let matX = undefined,
matY = undefined;
if (!h || !w) return [matX, matY];
const {
filter: filterX,
mapper: mapperX
} = configX,
{
filter: filterY,
mapper: mapperY
} = configY;
matrixMapper.iterate(wordx, (v, i, j) => {
var _dtX, _dtY;
var _matX, _matY;
if (filterX(v) && ((_dtX = dtX) !== null && _dtX !== void 0 ? _dtX : dtX = matrixInit.iso(h, w, undefined))) {
var _dtX$max;
if (filterX(v) && ((_matX = matX) !== null && _matX !== void 0 ? _matX : matX = matrixInit.iso(h, w, undefined))) {
var _matX$max;
v = mapperX(v);
if (v > ((_dtX$max = dtX.max) !== null && _dtX$max !== void 0 ? _dtX$max : dtX.max = dtX.min = v)) {
dtX.max = v;
} else if (v < dtX.min) {
dtX.min = v;
if (v > ((_matX$max = matX.max) !== null && _matX$max !== void 0 ? _matX$max : matX.max = matX.min = v)) {
matX.max = v;
} else if (v < matX.min) {
matX.min = v;
}
return dtX[i][j] = v;
return matX[i][j] = v;
}
if (filterY(v) && ((_dtY = dtY) !== null && _dtY !== void 0 ? _dtY : dtY = matrixInit.iso(h, w, undefined))) {
var _dtY$max;
if (filterY(v) && ((_matY = matY) !== null && _matY !== void 0 ? _matY : matY = matrixInit.iso(h, w, undefined))) {
var _matY$max;
v = mapperY(v);
if (v > ((_dtY$max = dtY.max) !== null && _dtY$max !== void 0 ? _dtY$max : dtY.max = dtY.min = v)) {
dtY.max = v;
} else if (v < dtY.min) {
dtY.min = v;
if (v > ((_matY$max = matY.max) !== null && _matY$max !== void 0 ? _matY$max : matY.max = matY.min = v)) {
matY.max = v;
} else if (v < matY.min) {
matY.min = v;
}
return dtY[i][j] = v;
return matY[i][j] = v;
}

@@ -124,6 +124,5 @@

}, h, w);
return [dtX, dtY];
return [matX, matY];
};
const parseNumeric = x => +x;
/**

@@ -140,3 +139,3 @@ *

* @param {*[][]} wordx
* @param {Config} [opt]
* @param {Config} [config]
* @return {?BoundedMatrix}

@@ -146,5 +145,3 @@ */

const solebound = (wordx, opt) => {
var _opt$filter, _opt$mapper;
const solebound = (wordx, config) => {
const [height, width] = matrixSize.size(wordx);

@@ -155,11 +152,13 @@ /** @type {?BoundedMatrix} */

if (!height || !width) return mx;
const filterX = (_opt$filter = opt === null || opt === void 0 ? void 0 : opt.filter) !== null && _opt$filter !== void 0 ? _opt$filter : numeral.isNumeric,
mapX = (_opt$mapper = opt === null || opt === void 0 ? void 0 : opt.mapper) !== null && _opt$mapper !== void 0 ? _opt$mapper : parseNumeric;
const {
filter,
mapper
} = config;
matrixMapper.iterate(wordx, (v, i, j) => {
var _mx;
if (filterX(v) && ((_mx = mx) !== null && _mx !== void 0 ? _mx : mx = matrixInit.iso(height, width, undefined))) {
if (filter(v) && ((_mx = mx) !== null && _mx !== void 0 ? _mx : mx = matrixInit.iso(height, width, undefined))) {
var _mx$max;
v = mapX(v);
v = mapper(v);

@@ -250,6 +249,14 @@ if (v > ((_mx$max = mx.max) !== null && _mx$max !== void 0 ? _mx$max : mx.max = mx.min = v)) {

const [x = {}, y = {}] = 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;
y.filter = (_y$filter = y === null || y === void 0 ? void 0 : y.filter) !== null && _y$filter !== void 0 ? _y$filter : literal.hasLiteralAny, y.mapper = (_y$mapper = y === null || y === void 0 ? void 0 : y.mapper) !== null && _y$mapper !== void 0 ? _y$mapper : stringValue.stringValue;
return duobound(wordx, [x, y]);
const [x, y] = configs;
const fX = (_x$filter = x === null || x === void 0 ? void 0 : x.filter) !== null && _x$filter !== void 0 ? _x$filter : numeral.isNumeric,
mX = (_x$mapper = x === null || x === void 0 ? void 0 : x.mapper) !== null && _x$mapper !== void 0 ? _x$mapper : numeral.parseNum;
const fY = (_y$filter = y === null || y === void 0 ? void 0 : y.filter) !== null && _y$filter !== void 0 ? _y$filter : literal.hasLiteralAny,
mY = (_y$mapper = y === null || y === void 0 ? void 0 : y.mapper) !== null && _y$mapper !== void 0 ? _y$mapper : stringValue.stringValue;
return duobound(wordx, [{
filter: fX,
mapper: mX
}, {
filter: fY,
mapper: mY
}]);
}

@@ -260,5 +267,9 @@

const [x = {}] = configs;
x.filter = (_x$filter2 = x === null || x === void 0 ? void 0 : x.filter) !== null && _x$filter2 !== void 0 ? _x$filter2 : numeral.isNumeric, x.mapper = (_x$mapper2 = x === null || x === void 0 ? void 0 : x.mapper) !== null && _x$mapper2 !== void 0 ? _x$mapper2 : numeral.parseNum;
return [solebound(wordx, x)];
const [x] = configs;
const filter = (_x$filter2 = x === null || x === void 0 ? void 0 : x.filter) !== null && _x$filter2 !== void 0 ? _x$filter2 : numeral.isNumeric,
mapper = (_x$mapper2 = x === null || x === void 0 ? void 0 : x.mapper) !== null && _x$mapper2 !== void 0 ? _x$mapper2 : numeral.parseNum;
return [solebound(wordx, {
filter,
mapper
})];
}

@@ -265,0 +276,0 @@

@@ -73,44 +73,44 @@ import { bound as bound$1 } from '@aryth/bound-vector';

const duobound = (wordx, [configX = {}, configY = {}] = []) => {
const duobound = (wordx, [configX, configY] = []) => {
const [h, w] = size(wordx);
/** @type {?BoundedMatrix} */
let dtX = undefined;
/** @type {?BoundedMatrix} */
let dtY = undefined;
if (!h || !w) return [dtX, dtY];
const filterX = configX.filter,
mapperX = configX.mapper;
const filterY = configY.filter,
mapperY = configY.mapper;
let matX = undefined,
matY = undefined;
if (!h || !w) return [matX, matY];
const {
filter: filterX,
mapper: mapperX
} = configX,
{
filter: filterY,
mapper: mapperY
} = configY;
iterate(wordx, (v, i, j) => {
var _dtX, _dtY;
var _matX, _matY;
if (filterX(v) && ((_dtX = dtX) !== null && _dtX !== void 0 ? _dtX : dtX = iso(h, w, undefined))) {
var _dtX$max;
if (filterX(v) && ((_matX = matX) !== null && _matX !== void 0 ? _matX : matX = iso(h, w, undefined))) {
var _matX$max;
v = mapperX(v);
if (v > ((_dtX$max = dtX.max) !== null && _dtX$max !== void 0 ? _dtX$max : dtX.max = dtX.min = v)) {
dtX.max = v;
} else if (v < dtX.min) {
dtX.min = v;
if (v > ((_matX$max = matX.max) !== null && _matX$max !== void 0 ? _matX$max : matX.max = matX.min = v)) {
matX.max = v;
} else if (v < matX.min) {
matX.min = v;
}
return dtX[i][j] = v;
return matX[i][j] = v;
}
if (filterY(v) && ((_dtY = dtY) !== null && _dtY !== void 0 ? _dtY : dtY = iso(h, w, undefined))) {
var _dtY$max;
if (filterY(v) && ((_matY = matY) !== null && _matY !== void 0 ? _matY : matY = iso(h, w, undefined))) {
var _matY$max;
v = mapperY(v);
if (v > ((_dtY$max = dtY.max) !== null && _dtY$max !== void 0 ? _dtY$max : dtY.max = dtY.min = v)) {
dtY.max = v;
} else if (v < dtY.min) {
dtY.min = v;
if (v > ((_matY$max = matY.max) !== null && _matY$max !== void 0 ? _matY$max : matY.max = matY.min = v)) {
matY.max = v;
} else if (v < matY.min) {
matY.min = v;
}
return dtY[i][j] = v;
return matY[i][j] = v;
}

@@ -120,6 +120,5 @@

}, h, w);
return [dtX, dtY];
return [matX, matY];
};
const parseNumeric = x => +x;
/**

@@ -136,3 +135,3 @@ *

* @param {*[][]} wordx
* @param {Config} [opt]
* @param {Config} [config]
* @return {?BoundedMatrix}

@@ -142,5 +141,3 @@ */

const solebound = (wordx, opt) => {
var _opt$filter, _opt$mapper;
const solebound = (wordx, config) => {
const [height, width] = size(wordx);

@@ -151,11 +148,13 @@ /** @type {?BoundedMatrix} */

if (!height || !width) return mx;
const filterX = (_opt$filter = opt === null || opt === void 0 ? void 0 : opt.filter) !== null && _opt$filter !== void 0 ? _opt$filter : isNumeric,
mapX = (_opt$mapper = opt === null || opt === void 0 ? void 0 : opt.mapper) !== null && _opt$mapper !== void 0 ? _opt$mapper : parseNumeric;
const {
filter,
mapper
} = config;
iterate(wordx, (v, i, j) => {
var _mx;
if (filterX(v) && ((_mx = mx) !== null && _mx !== void 0 ? _mx : mx = iso(height, width, undefined))) {
if (filter(v) && ((_mx = mx) !== null && _mx !== void 0 ? _mx : mx = iso(height, width, undefined))) {
var _mx$max;
v = mapX(v);
v = mapper(v);

@@ -246,6 +245,14 @@ if (v > ((_mx$max = mx.max) !== null && _mx$max !== void 0 ? _mx$max : mx.max = mx.min = v)) {

const [x = {}, y = {}] = 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;
y.filter = (_y$filter = y === null || y === void 0 ? void 0 : y.filter) !== null && _y$filter !== void 0 ? _y$filter : hasLiteralAny, y.mapper = (_y$mapper = y === null || y === void 0 ? void 0 : y.mapper) !== null && _y$mapper !== void 0 ? _y$mapper : stringValue;
return duobound(wordx, [x, y]);
const [x, y] = configs;
const fX = (_x$filter = x === null || x === void 0 ? void 0 : x.filter) !== null && _x$filter !== void 0 ? _x$filter : isNumeric,
mX = (_x$mapper = x === null || x === void 0 ? void 0 : x.mapper) !== null && _x$mapper !== void 0 ? _x$mapper : parseNum;
const fY = (_y$filter = y === null || y === void 0 ? void 0 : y.filter) !== null && _y$filter !== void 0 ? _y$filter : hasLiteralAny,
mY = (_y$mapper = y === null || y === void 0 ? void 0 : y.mapper) !== null && _y$mapper !== void 0 ? _y$mapper : stringValue;
return duobound(wordx, [{
filter: fX,
mapper: mX
}, {
filter: fY,
mapper: mY
}]);
}

@@ -256,5 +263,9 @@

const [x = {}] = configs;
x.filter = (_x$filter2 = x === null || x === void 0 ? void 0 : x.filter) !== null && _x$filter2 !== void 0 ? _x$filter2 : isNumeric, x.mapper = (_x$mapper2 = x === null || x === void 0 ? void 0 : x.mapper) !== null && _x$mapper2 !== void 0 ? _x$mapper2 : parseNum;
return [solebound(wordx, x)];
const [x] = configs;
const filter = (_x$filter2 = x === null || x === void 0 ? void 0 : x.filter) !== null && _x$filter2 !== void 0 ? _x$filter2 : isNumeric,
mapper = (_x$mapper2 = x === null || x === void 0 ? void 0 : x.mapper) !== null && _x$mapper2 !== void 0 ? _x$mapper2 : parseNum;
return [solebound(wordx, {
filter,
mapper
})];
}

@@ -261,0 +272,0 @@

{
"name": "@aryth/bound-matrix",
"version": "0.3.7",
"version": "0.3.10",
"description": "A math util library",

@@ -18,4 +18,4 @@ "main": "dist/index.cjs.js",

"dependencies": {
"@aryth/bound-vector": "^0.3.7",
"@aryth/util-bound": "^0.3.7",
"@aryth/bound-vector": "^0.3.10",
"@aryth/util-bound": "^0.3.10",
"@ject/oneself": "^0.0.6",

@@ -45,3 +45,3 @@ "@spare/string-value": "^0.10.14",

"homepage": "https://github.com/hoyeungw/aryth#readme",
"gitHead": "d0ab19ca01867037f451ba070815833e5e0c72d1"
"gitHead": "10e562e31e7307a5988e893892d8a13614b4dc6a"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc