@bemoje/array 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bemoje/array",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "array related tools/util.",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {},
@@ -13,10 +13,10 @@
13
13
  "keywords": [],
14
14
  "dependencies": {
15
15
  "@bemoje/number": "latest",
16
- "@bemoje/sort": "latest",
17
16
  "@bemoje/string": "latest",
18
17
  "@bemoje/validation": "latest",
19
- "tslib": "^2.3.0"
18
+ "tslib": "^2.3.0",
19
+ "@bemoje/sort": "latest"
20
20
  },
21
21
  "repository": {
22
22
  "type": "git",
@@ -32,5 +32,6 @@
32
32
  "homepage": "https://github.com/bemoje/tsmono",
33
33
  "type": "commonjs",
34
34
  "typings": "./src/index.d.ts",
35
+ "devDependencies": {},
35
36
  "types": "./src/index.d.ts"
36
37
  }
package/src/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export * from './lib/arrSum';
21
21
  export * from './lib/arrSwap';
22
22
  export * from './lib/arrTableAssertRowsSameLength';
23
23
  export * from './lib/arrTableEachToString';
24
+ export * from './lib/arrTableRemoveColumns';
24
25
  export * from './lib/arrTableToCsv';
25
26
  export * from './lib/arrTableToObjects';
26
27
  export * from './lib/types/ArrayPredicate';
package/src/index.js CHANGED
@@ -24,6 +24,7 @@ tslib_1.__exportStar(require("./lib/arrSum"), exports);
24
24
  tslib_1.__exportStar(require("./lib/arrSwap"), exports);
25
25
  tslib_1.__exportStar(require("./lib/arrTableAssertRowsSameLength"), exports);
26
26
  tslib_1.__exportStar(require("./lib/arrTableEachToString"), exports);
27
+ tslib_1.__exportStar(require("./lib/arrTableRemoveColumns"), exports);
27
28
  tslib_1.__exportStar(require("./lib/arrTableToCsv"), exports);
28
29
  tslib_1.__exportStar(require("./lib/arrTableToObjects"), exports);
29
30
  tslib_1.__exportStar(require("./lib/types/ArrayPredicate"), exports);
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/array/src/index.ts"],"names":[],"mappings":";;;AAAA,2DAAgC;AAChC,gEAAqC;AACrC,yDAA8B;AAC9B,iEAAsC;AACtC,4DAAiC;AACjC,mEAAwC;AACxC,2DAAgC;AAChC,6DAAkC;AAClC,wDAA6B;AAC7B,8DAAmC;AACnC,kEAAuC;AACvC,qEAA0C;AAC1C,oEAAyC;AACzC,iEAAsC;AACtC,2DAAgC;AAChC,wDAA6B;AAC7B,wEAA6C;AAC7C,+DAAoC;AACpC,yDAA8B;AAC9B,uDAA4B;AAC5B,wDAA6B;AAC7B,6EAAkD;AAClD,qEAA0C;AAC1C,8DAAmC;AACnC,kEAAuC;AACvC,qEAA0C;AAC1C,yEAA8C;AAC9C,wEAA6C;AAC7C,kEAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/array/src/index.ts"],"names":[],"mappings":";;;AAAA,2DAAgC;AAChC,gEAAqC;AACrC,yDAA8B;AAC9B,iEAAsC;AACtC,4DAAiC;AACjC,mEAAwC;AACxC,2DAAgC;AAChC,6DAAkC;AAClC,wDAA6B;AAC7B,8DAAmC;AACnC,kEAAuC;AACvC,qEAA0C;AAC1C,oEAAyC;AACzC,iEAAsC;AACtC,2DAAgC;AAChC,wDAA6B;AAC7B,wEAA6C;AAC7C,+DAAoC;AACpC,yDAA8B;AAC9B,uDAA4B;AAC5B,wDAA6B;AAC7B,6EAAkD;AAClD,qEAA0C;AAC1C,sEAA2C;AAC3C,8DAAmC;AACnC,kEAAuC;AACvC,qEAA0C;AAC1C,yEAA8C;AAC9C,wEAA6C;AAC7C,kEAAuC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Removes specified columns from a 2D array table.
3
+ * @param table - The 2D array (table) from which columns will be removed. The first row of the table is assumed to contain column names.
4
+ * @param removeColumnNames - The names of the columns to be removed. These should match the entries in the first row of the table.
5
+ * @returns A new 2D array (table) with the specified columns removed.
6
+ */
7
+ export declare function arrTableRemoveColumns(table: string[][], ...removeColumnNames: string[]): string[][];
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.arrTableRemoveColumns = void 0;
4
+ const arrIndicesOf_1 = require("./arrIndicesOf");
5
+ /**
6
+ * Removes specified columns from a 2D array table.
7
+ * @param table - The 2D array (table) from which columns will be removed. The first row of the table is assumed to contain column names.
8
+ * @param removeColumnNames - The names of the columns to be removed. These should match the entries in the first row of the table.
9
+ * @returns A new 2D array (table) with the specified columns removed.
10
+ */
11
+ function arrTableRemoveColumns(table, ...removeColumnNames) {
12
+ if (!removeColumnNames.length || !table.length)
13
+ return table;
14
+ const set = new Set(removeColumnNames.map((col) => (0, arrIndicesOf_1.arrIndicesOf)(table[0], col)).flat());
15
+ return table.map((row) => row.filter((_, i) => !set.has(i)));
16
+ }
17
+ exports.arrTableRemoveColumns = arrTableRemoveColumns;
18
+ //# sourceMappingURL=arrTableRemoveColumns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrTableRemoveColumns.js","sourceRoot":"","sources":["../../../../../packages/array/src/lib/arrTableRemoveColumns.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAE7C;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,KAAiB,EAAE,GAAG,iBAA2B;IACrF,IAAI,CAAC,iBAAiB,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IAC5D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,2BAAY,EAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IACvF,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC9D,CAAC;AAJD,sDAIC"}