Sparray.js is an Open source arrays toolkit library for Javascript.
- Only 1 small dependency to check inputs variables
- Very lightweight
- Thoroughly tested
- Works in Javascript, Typescript and Node.js
- Can be used as CommonJS or EcmaScrypt module
- Written in Typescript
- node: 14
This is the oldest targeted versions. The library should work properly on older versions of Node.js but we do not support it officially.
$ npm i @dwtechs/sparray
import { chunk } from "@dwtechs/sparray";
function chunkArray(req, res, next) {
req.chunks = chunk(req.body.rows, null);
next();
}
export {
chunkArray,
};
const sp = require("@dwtechs/sparray");
function chunk(req, res, next) {
req.chunks = sp.chunk(req.body.rows, null);
next();
}
module.exports = {
chunk,
};
let chunkSize = 100 //Default value
getChunkSize(): number {}
setChunkSize(size: number): number {}
chunk(rows: any[], size?: number = chunkSize): any[] {}
checkCommonValues(a: any[], b: any[]): boolean {}
getCommonValues(a: any[], b: any[]): any[] {}
// Flatten a chunked array
flatten(chunks: any[]): any[] {}
// delete a list of properties
deleteProps(arr: Record<string, any>[], props: string[]): Record<string, any>[] {}
Sparray.js is still in development and we would be glad to get all the help you can provide. To contribute please read contributor.md for detailed installation guide.
Purpose | Choice | Motivation |
---|---|---|
repository | Github | hosting for software development version control using Git |
package manager | npm | default node.js package manager |
language | TypeScript | static type checking along with the latest ECMAScript features |
module bundler | Rollup | advanced module bundler for ES6 modules |
unit testing | Jest | delightful testing with a focus on simplicity |