Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

borel

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

borel - npm Package Compare versions

Comparing version 0.1.10 to 0.1.11

78

dist/index.cjs.js

@@ -420,19 +420,2 @@ 'use strict';

function sortRows(rows, y, sort) {
if (typeof sort === 'function') return rows.sort((a, b) => sort(a[y], b[y]));
switch (sort) {
case true:
case 'desc':
return rows.sort((a, b) => b[y] - a[y]);
case 'asc':
return rows.sort((a, b) => a[y] - b[y]);
case false:
default:
return rows;
}
}
class StatMx {

@@ -548,2 +531,15 @@ static cnt(mx) {

}
static distinct(mx, y) {
let [h, w] = size(mx);
if (!h || !w || y >= w) return [[]];
let rows = [];
for (let i = 0, _r; i < h; i++) {
_r = mx[i];
if (rows.findIndex(r => _r[y] === r[y]) < 0) rows.push(_r);
}
return rows;
}
/**

@@ -554,3 +550,3 @@ *

* @param {boolean} [count=false]
* @param {function|string|boolean} [sort=false] - When sort is function, sort must be a comparer between two point element.
* @param {string|boolean} [sort=false] - When sort is function, sort must be a comparer between two point element.
* @returns {[any, any][]|[]|any[]|*}

@@ -567,36 +563,22 @@ */

switch (count) {
case false:
case 0:
const dist = [];
if (!count) {
const dist = [];
for (let i = 0, el; i < h; i++) {
el = mx[i][y];
if (dist.indexOf(el) < 0) dist.push(el);
}
for (let i = 0, el; i < h; i++) {
el = mx[i][y];
if (dist.indexOf(el) < 0) dist.push(el);
}
return dist;
return dist;
} else {
let ents = [];
case true:
case 1:
let ents = [];
for (let i = 0, j, el; i < h; i++) {
el = mx[i][y];
j = ents.findIndex(x => el === x[0]);
if (j < 0) j += ents.push([el, 0]);
ents[j][1]++;
}
for (let i = 0, j, el; i < h; i++) {
el = mx[i][y];
j = ents.findIndex(x => el === x[0]);
if (j < 0) j += ents.push([el, 0]);
ents[j][1]++;
}
return sortEntries(ents, sort);
default:
let rows = [];
for (let i = 0, _r; i < h; i++) {
_r = mx[i];
if (rows.findIndex(r => _r[y] === r[y]) < 0) rows.push(_r);
}
return sortRows(rows, y, sort);
return sortEntries(ents, sort);
}

@@ -603,0 +585,0 @@ }

@@ -416,19 +416,2 @@ import { NumLoose, Num } from 'typen';

function sortRows(rows, y, sort) {
if (typeof sort === 'function') return rows.sort((a, b) => sort(a[y], b[y]));
switch (sort) {
case true:
case 'desc':
return rows.sort((a, b) => b[y] - a[y]);
case 'asc':
return rows.sort((a, b) => a[y] - b[y]);
case false:
default:
return rows;
}
}
class StatMx {

@@ -544,2 +527,15 @@ static cnt(mx) {

}
static distinct(mx, y) {
let [h, w] = size(mx);
if (!h || !w || y >= w) return [[]];
let rows = [];
for (let i = 0, _r; i < h; i++) {
_r = mx[i];
if (rows.findIndex(r => _r[y] === r[y]) < 0) rows.push(_r);
}
return rows;
}
/**

@@ -550,3 +546,3 @@ *

* @param {boolean} [count=false]
* @param {function|string|boolean} [sort=false] - When sort is function, sort must be a comparer between two point element.
* @param {string|boolean} [sort=false] - When sort is function, sort must be a comparer between two point element.
* @returns {[any, any][]|[]|any[]|*}

@@ -563,36 +559,22 @@ */

switch (count) {
case false:
case 0:
const dist = [];
if (!count) {
const dist = [];
for (let i = 0, el; i < h; i++) {
el = mx[i][y];
if (dist.indexOf(el) < 0) dist.push(el);
}
for (let i = 0, el; i < h; i++) {
el = mx[i][y];
if (dist.indexOf(el) < 0) dist.push(el);
}
return dist;
return dist;
} else {
let ents = [];
case true:
case 1:
let ents = [];
for (let i = 0, j, el; i < h; i++) {
el = mx[i][y];
j = ents.findIndex(x => el === x[0]);
if (j < 0) j += ents.push([el, 0]);
ents[j][1]++;
}
for (let i = 0, j, el; i < h; i++) {
el = mx[i][y];
j = ents.findIndex(x => el === x[0]);
if (j < 0) j += ents.push([el, 0]);
ents[j][1]++;
}
return sortEntries(ents, sort);
default:
let rows = [];
for (let i = 0, _r; i < h; i++) {
_r = mx[i];
if (rows.findIndex(r => _r[y] === r[y]) < 0) rows.push(_r);
}
return sortRows(rows, y, sort);
return sortEntries(ents, sort);
}

@@ -599,0 +581,0 @@ }

@@ -519,25 +519,2 @@ (function (global, factory) {

function sortRows(rows, y, sort) {
if (typeof sort === 'function') return rows.sort(function (a, b) {
return sort(a[y], b[y]);
});
switch (sort) {
case true:
case 'desc':
return rows.sort(function (a, b) {
return b[y] - a[y];
});
case 'asc':
return rows.sort(function (a, b) {
return a[y] - b[y];
});
case false:
default:
return rows;
}
}
var StatMx =

@@ -673,2 +650,25 @@ /*#__PURE__*/

return toBound(max, min, dif);
};
StatMx.distinct = function distinct(mx, y) {
var _size3 = size(mx),
h = _size3[0],
w = _size3[1];
if (!h || !w || y >= w) return [[]];
var rows = [];
var _loop = function _loop(i, _r2) {
_r2 = mx[i];
if (rows.findIndex(function (r) {
return _r2[y] === r[y];
}) < 0) rows.push(_r2);
_r = _r2;
};
for (var i = 0, _r; i < h; i++) {
_loop(i, _r);
}
return rows;
}

@@ -680,3 +680,3 @@ /**

* @param {boolean} [count=false]
* @param {function|string|boolean} [sort=false] - When sort is function, sort must be a comparer between two point element.
* @param {string|boolean} [sort=false] - When sort is function, sort must be a comparer between two point element.
* @returns {[any, any][]|[]|any[]|*}

@@ -693,57 +693,36 @@ */

var _size3 = size(mx),
h = _size3[0],
w = _size3[1];
var _size4 = size(mx),
h = _size4[0],
w = _size4[1];
if (!h || !w || y >= w) return count ? [[]] : [];
switch (count) {
case false:
case 0:
var dist = [];
if (!count) {
var dist = [];
for (var i = 0, el; i < h; i++) {
el = mx[i][y];
if (dist.indexOf(el) < 0) dist.push(el);
}
for (var i = 0, el; i < h; i++) {
el = mx[i][y];
if (dist.indexOf(el) < 0) dist.push(el);
}
return dist;
return dist;
} else {
var ents = [];
case true:
case 1:
var ents = [];
var _loop2 = function _loop2(_j, _i2, _el2) {
_el2 = mx[_i2][y];
_j = ents.findIndex(function (x) {
return _el2 === x[0];
});
if (_j < 0) _j += ents.push([_el2, 0]);
ents[_j][1]++;
j = _j;
_el = _el2;
};
var _loop = function _loop(_j, _i2, _el2) {
_el2 = mx[_i2][y];
_j = ents.findIndex(function (x) {
return _el2 === x[0];
});
if (_j < 0) _j += ents.push([_el2, 0]);
ents[_j][1]++;
j = _j;
_el = _el2;
};
for (var _i2 = 0, j, _el; _i2 < h; _i2++) {
_loop2(j, _i2, _el);
}
for (var _i2 = 0, j, _el; _i2 < h; _i2++) {
_loop(j, _i2, _el);
}
return sortEntries(ents, sort);
default:
var rows = [];
var _loop2 = function _loop2(_r2, _i3) {
_r2 = mx[_i3];
if (rows.findIndex(function (r) {
return _r2[y] === r[y];
}) < 0) rows.push(_r2);
_r = _r2;
};
for (var _i3 = 0, _r; _i3 < h; _i3++) {
_loop2(_r, _i3);
}
return sortRows(rows, y, sort);
return sortEntries(ents, sort);
}

@@ -750,0 +729,0 @@ };

{
"name": "borel",
"version": "0.1.10",
"version": "0.1.11",
"description": "A light and simple math library",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

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