Socket
Socket
Sign inDemoInstall

@analys/table-divide

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@analys/table-divide - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

54

dist/index.cjs.js

@@ -5,35 +5,37 @@ 'use strict';

var enumMutabilities = require('@analys/enum-mutabilities');
var columnsSelect = require('@vect/columns-select');
var vectorSelect = require('@vect/vector-select');
var vectorMapper = require('@vect/vector-mapper');
var tableInit = require('@analys/table-init');
/**
* @param {Object<str,function(*):boolean>} filterObject
* @return {{includes:Table,excludes:Table}} - mutated 'this' {head, rows}
* Divide a table by fields
* @param {*[]} fields
* @return {{ pick:TableObject, rest:TableObject }} - mutated 'this' {head, rows}
*/
const tableDivide = function ({
includes,
excludes
}) {
/** @type {Table} */
let body = this;
const tableDivide = function (fields) {
var _this, _this2;
if (includes && includes.length) {
const [regenerated, body] = [body.spliceColumns(includes, enumMutabilities.IMMUTABLE), body.select(includes, enumMutabilities.MUTABLE)];
return {
includes: body,
excludes: regenerated
};
}
/** @type {Table|TableObject} */
const rs = (_this = this, tableInit.slice(_this));
/** @type {Table|TableObject} */
if (excludes && includes.length) {
const [regenerated, body] = [body.select(excludes, enumMutabilities.IMMUTABLE), body.spliceColumns(excludes, enumMutabilities.MUTABLE)];
return {
includes: regenerated,
excludes: body
};
}
const pk = (_this2 = this, tableInit.slice(_this2));
const {
head,
rows
} = this;
const indexes = vectorMapper.mapper(fields, label => head.indexOf(label));
({
pick: pk.head,
rest: rs.head
} = vectorSelect.divide(head, indexes));
({
pick: pk.rows,
rest: rs.rows
} = columnsSelect.divide(rows, indexes));
return {
includes: body,
excludes: body
pick: pk,
rest: rs
};

@@ -40,0 +42,0 @@ };

@@ -1,34 +0,36 @@

import { IMMUTABLE, MUTABLE } from '@analys/enum-mutabilities';
import { divide as divide$1 } from '@vect/columns-select';
import { divide } from '@vect/vector-select';
import { mapper } from '@vect/vector-mapper';
import { slice } from '@analys/table-init';
/**
* @param {Object<str,function(*):boolean>} filterObject
* @return {{includes:Table,excludes:Table}} - mutated 'this' {head, rows}
* Divide a table by fields
* @param {*[]} fields
* @return {{ pick:TableObject, rest:TableObject }} - mutated 'this' {head, rows}
*/
const tableDivide = function ({
includes,
excludes
}) {
/** @type {Table} */
let body = this;
const tableDivide = function (fields) {
var _this, _this2;
if (includes && includes.length) {
const [regenerated, body] = [body.spliceColumns(includes, IMMUTABLE), body.select(includes, MUTABLE)];
return {
includes: body,
excludes: regenerated
};
}
/** @type {Table|TableObject} */
const rs = (_this = this, slice(_this));
/** @type {Table|TableObject} */
if (excludes && includes.length) {
const [regenerated, body] = [body.select(excludes, IMMUTABLE), body.spliceColumns(excludes, MUTABLE)];
return {
includes: regenerated,
excludes: body
};
}
const pk = (_this2 = this, slice(_this2));
const {
head,
rows
} = this;
const indexes = mapper(fields, label => head.indexOf(label));
({
pick: pk.head,
rest: rs.head
} = divide(head, indexes));
({
pick: pk.rows,
rest: rs.rows
} = divide$1(rows, indexes));
return {
includes: body,
excludes: body
pick: pk,
rest: rs
};

@@ -35,0 +37,0 @@ };

{
"name": "@analys/table-divide",
"version": "0.0.12",
"version": "0.0.13",
"description": "A cross-table-divide analytics tool",

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

"dependencies": {
"@analys/enum-mutabilities": "^0.0.12"
"@analys/enum-mutabilities": "^0.0.13",
"@analys/table-init": "^0.0.13",
"@vect/columns-select": "^0.1.12",
"@vect/vector-mapper": "^0.1.12",
"@vect/vector-select": "^0.1.12"
},

@@ -41,3 +45,3 @@ "repository": {

"homepage": "https://github.com/hoyeungw/analys#readme",
"gitHead": "2b74be88f325ad83497a1a1d5305914f089a2688"
"gitHead": "2d47d8c77ab23f890ff0b9e3b6608f0d98a3989f"
}
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