chore: update to version 14.0.11 and align website URLs

This commit is contained in:
2026-01-11 11:34:13 +03:00
parent ef74383349
commit 19c8d69bd8
1499 changed files with 53633 additions and 89 deletions
+15
View File
@@ -0,0 +1,15 @@
/**
* @name arrayChunk
* @summary Split T[] into T[][] based on the defind size
* @description
* Returns a set ao arrays based on the chunksize
* @example
* <BR>
*
* ```javascript
* import { arrayChunk } from '@pezkuwi/util';
*
* arrayChunk([1, 2, 3, 4, 5]); // [[1, 2], [3, 4], [5]]
* ```
*/
export declare function arrayChunk<T>(array: T[], chunkSize: number): T[][];
+30
View File
@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayChunk = arrayChunk;
/**
* @name arrayChunk
* @summary Split T[] into T[][] based on the defind size
* @description
* Returns a set ao arrays based on the chunksize
* @example
* <BR>
*
* ```javascript
* import { arrayChunk } from '@pezkuwi/util';
*
* arrayChunk([1, 2, 3, 4, 5]); // [[1, 2], [3, 4], [5]]
* ```
*/
function arrayChunk(array, chunkSize) {
const outputSize = Math.ceil(array.length / chunkSize);
// shortcut for the single-split case
if (outputSize === 1) {
return [array];
}
const output = Array(outputSize);
for (let i = 0; i < outputSize; i++) {
const offset = i * chunkSize;
output[i] = array.slice(offset, offset + chunkSize);
}
return output;
}
+16
View File
@@ -0,0 +1,16 @@
/**
* @name arrayFilter
* @summary Filters undefined and (optionally) null values from an array
* @description
* Returns a new array with all `undefined` values removed. Optionally, when `allowNulls = false`, it removes the `null` values as well
* @example
* <BR>
*
* ```javascript
* import { arrayFilter } from '@pezkuwi/util';
*
* arrayFilter([0, void 0, true, null, false, '']); // [0, true, null, false, '']
* arrayFilter([0, void 0, true, null, false, ''], false); // [0, true, false, '']
* ```
*/
export declare function arrayFilter<T = unknown>(array: readonly (T | null | undefined)[], allowNulls?: boolean): T[];
+22
View File
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayFilter = arrayFilter;
/**
* @name arrayFilter
* @summary Filters undefined and (optionally) null values from an array
* @description
* Returns a new array with all `undefined` values removed. Optionally, when `allowNulls = false`, it removes the `null` values as well
* @example
* <BR>
*
* ```javascript
* import { arrayFilter } from '@pezkuwi/util';
*
* arrayFilter([0, void 0, true, null, false, '']); // [0, true, null, false, '']
* arrayFilter([0, void 0, true, null, false, ''], false); // [0, true, false, '']
* ```
*/
function arrayFilter(array, allowNulls = true) {
return array.filter((v) => v !== undefined &&
(allowNulls || v !== null));
}
+15
View File
@@ -0,0 +1,15 @@
/**
* @name arrayFlatten
* @summary Merge T[][] into T[]
* @description
* Returns a new array with all arrays merged into one
* @example
* <BR>
*
* ```javascript
* import { arrayFlatten } from '@pezkuwi/util';
*
* arrayFlatten([[1, 2], [3, 4], [5]]); // [1, 2, 3, 4, 5]
* ```
*/
export declare function arrayFlatten<T>(arrays: readonly T[][]): T[];
+42
View File
@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayFlatten = arrayFlatten;
/**
* @name arrayFlatten
* @summary Merge T[][] into T[]
* @description
* Returns a new array with all arrays merged into one
* @example
* <BR>
*
* ```javascript
* import { arrayFlatten } from '@pezkuwi/util';
*
* arrayFlatten([[1, 2], [3, 4], [5]]); // [1, 2, 3, 4, 5]
* ```
*/
function arrayFlatten(arrays) {
const num = arrays.length;
// shortcuts for the empty & single-entry case
if (num === 0) {
return [];
}
else if (num === 1) {
return arrays[0];
}
// pre-allocate based on the combined size
let size = 0;
for (let i = 0; i < num; i++) {
size += arrays[i].length;
}
const output = new Array(size);
let i = -1;
for (let j = 0; j < num; j++) {
const a = arrays[j];
// instead of pushing, we just set the entries
for (let e = 0, count = a.length; e < count; e++) {
output[++i] = a[e];
}
}
return output;
}
+10
View File
@@ -0,0 +1,10 @@
/**
* @summary Utility methods that operates on arrays
*/
export { arrayChunk } from './chunk.js';
export { arrayFilter } from './filter.js';
export { arrayFlatten } from './flatten.js';
export { arrayRange } from './range.js';
export { arrayShuffle } from './shuffle.js';
export { arrayUnzip } from './unzip.js';
export { arrayZip } from './zip.js';
+20
View File
@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayZip = exports.arrayUnzip = exports.arrayShuffle = exports.arrayRange = exports.arrayFlatten = exports.arrayFilter = exports.arrayChunk = void 0;
/**
* @summary Utility methods that operates on arrays
*/
var chunk_js_1 = require("./chunk.js");
Object.defineProperty(exports, "arrayChunk", { enumerable: true, get: function () { return chunk_js_1.arrayChunk; } });
var filter_js_1 = require("./filter.js");
Object.defineProperty(exports, "arrayFilter", { enumerable: true, get: function () { return filter_js_1.arrayFilter; } });
var flatten_js_1 = require("./flatten.js");
Object.defineProperty(exports, "arrayFlatten", { enumerable: true, get: function () { return flatten_js_1.arrayFlatten; } });
var range_js_1 = require("./range.js");
Object.defineProperty(exports, "arrayRange", { enumerable: true, get: function () { return range_js_1.arrayRange; } });
var shuffle_js_1 = require("./shuffle.js");
Object.defineProperty(exports, "arrayShuffle", { enumerable: true, get: function () { return shuffle_js_1.arrayShuffle; } });
var unzip_js_1 = require("./unzip.js");
Object.defineProperty(exports, "arrayUnzip", { enumerable: true, get: function () { return unzip_js_1.arrayUnzip; } });
var zip_js_1 = require("./zip.js");
Object.defineProperty(exports, "arrayZip", { enumerable: true, get: function () { return zip_js_1.arrayZip; } });
+16
View File
@@ -0,0 +1,16 @@
/**
* @name arrayRange
* @summary Returns a range of numbers ith the size and the specified offset
* @description
* Returns a new array of numbers with the specific size. Optionally, when `startAt`, is provided, it generates the range to start at a specific value.
* @example
* <BR>
*
* ```javascript
* import { arrayRange } from '@pezkuwi/util';
*
* arrayRange(5); // [0, 1, 2, 3, 4]
* arrayRange(3, 5); // [5, 6, 7]
* ```
*/
export declare function arrayRange(size: number, startAt?: number): number[];
+28
View File
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayRange = arrayRange;
/**
* @name arrayRange
* @summary Returns a range of numbers ith the size and the specified offset
* @description
* Returns a new array of numbers with the specific size. Optionally, when `startAt`, is provided, it generates the range to start at a specific value.
* @example
* <BR>
*
* ```javascript
* import { arrayRange } from '@pezkuwi/util';
*
* arrayRange(5); // [0, 1, 2, 3, 4]
* arrayRange(3, 5); // [5, 6, 7]
* ```
*/
function arrayRange(size, startAt = 0) {
if (size <= 0) {
throw new Error('Expected non-zero, positive number as a range size');
}
const result = new Array(size);
for (let i = 0; i < size; i++) {
result[i] = i + startAt;
}
return result;
}
+5
View File
@@ -0,0 +1,5 @@
/**
* @name arrayShuffle
* @description Shuffles the input array (unlike sort, this is not done in-place)
*/
export declare function arrayShuffle<T>(input: readonly T[]): T[];
+22
View File
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayShuffle = arrayShuffle;
/**
* @name arrayShuffle
* @description Shuffles the input array (unlike sort, this is not done in-place)
*/
function arrayShuffle(input) {
const result = input.slice();
let curr = result.length;
// noop for the single entry
if (curr === 1) {
return result;
}
while (curr !== 0) {
// ~~ is more performant than Math.floor
const rand = ~~(Math.random() * curr);
curr--;
[result[curr], result[rand]] = [result[rand], result[curr]];
}
return result;
}
+5
View File
@@ -0,0 +1,5 @@
/**
* @name arrayUnzip
* @description Splits a single [K, V][] into [K[], V[]]
*/
export declare function arrayUnzip<K, V>(entries: readonly [K, V][]): [K[], V[]];
+16
View File
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayUnzip = arrayUnzip;
/**
* @name arrayUnzip
* @description Splits a single [K, V][] into [K[], V[]]
*/
function arrayUnzip(entries) {
const count = entries.length;
const keys = new Array(count);
const values = new Array(count);
for (let i = 0; i < count; i++) {
[keys[i], values[i]] = entries[i];
}
return [keys, values];
}
+5
View File
@@ -0,0 +1,5 @@
/**
* @name arrayZip
* @description Combines 2 distinct key/value arrays into a single [K, V] array
*/
export declare function arrayZip<K, V>(keys: readonly K[], values: readonly V[]): [K, V][];
+15
View File
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayZip = arrayZip;
/**
* @name arrayZip
* @description Combines 2 distinct key/value arrays into a single [K, V] array
*/
function arrayZip(keys, values) {
const count = keys.length;
const result = new Array(count);
for (let i = 0; i < count; i++) {
result[i] = [keys[i], values[i]];
}
return result;
}