1.0.7 • Published 3 years ago

jsmp-infra-wecreus v1.0.7

Weekly downloads
10
License
ISC
Repository
-
Last release
3 years ago

This is a dummy npm package for training purposes.

Features

  • Split array into chunks with specified length.

  • Replace any character or sequence of characters in a string.

Installation

Install via Node.js:

$ npm install jsmp-infra-wecreus

Import as Node.js module:

const { splitArray, stringReplace } = require('jsmp-infra-wecreus');

Use

splitArray(array, size, [preserve = true]);

Function returns an array of elements split into groups the length of size Preserve indicates if uneven chunk should be included in the result. Defaults to true;

Example:

const resultPreserve = splitArray(["sample1", "sample2", "sample3", "sample4", "sample5"], 2);     // [["sample1", "sample2"], ["sample3", "sample4"], ["sample5"]]
const result = splitArray(["sample1", "sample2", "sample3", "sample4", "sample5"], 2, false);      // [["sample1", "sample2"], ["sample3", "sample4"]]
stringReplace(string, stringToReplace, [replacement = '']);

Function replaces stringToReplace found in string with replacement

Example:

const result = stringReplace('test', 'es');                     // "tt"
const resultReplace = stringReplace('test', 'st', 'sting');     // "testing"
1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago