[go: up one dir, main page]

@web-academy/core-lib
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Web.Academy Core-Library

Collection of core functionality

Helpers

ArrayHelper

ArrayHelper.chunk(arr: any[], size: number): any[][]

Splits an existing array into multiple arrays (chunks) with a given size.

let arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
let chunks = ArrayHelper.chunk(arr, 3);

// ==> chunks = [['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h']];

ArrayHelper.randomItem(arr: any[]): any

Returns a random item from given array

let arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
let item = ArrayHelper.randomItem(arr);

WaitHelper

WaitHelper.wait(ms: number): Promise

Waits for the given amount of ms and the resolves the promise

await WaitHelper.wait(500); // Waits for 500ms

Readme

Keywords

none

Package Sidebar

Install

npm i @web-academy/core-lib

Weekly Downloads

94

Version

1.0.3

License

MIT

Unpacked Size

11.4 kB

Total Files

12

Last publish

Collaborators

  • christian.schab