0.7.0 • Published 4 years ago
@hugoalh/more-method v0.7.0
More Method (NodeJS)
| Release | Latest ( | Pre ( |
|---|---|---|
| GitHub | ||
| NPM |
📝 Description
A NodeJS module to provide more method.
📚 Documentation
For the official documentation, please visit GitHub Repository Wiki.
Getting Started (Excerpt)
Install
NodeJS (>= v14.15.0) + NPM (>= v6.14.8):
npm install @hugoalh/more-methodUse In CommonJS
const moreMethod = require("@hugoalh/more-method");Use In ModuleJS
import * as moreMethod from "@hugoalh/more-method";API (Excerpt)
Class
Replaceholder@constructor(list, option?)replace(item)
Function
changeCase(item, option?)concatenate(...items)depth(item)divide(item, piece, option?)ensureEndWith(item, endWith)ensureStartWith(item, startWith)escapeRegularExpressionSpecialCharacters(item)flattenArray(item, option?)flattenJSON(item, option?)length(item, option?)mathematics.combination(n, k)mathematics.cumulativeCombination(n)mathematics.cumulativePermutation(n)mathematics.factorial(n)mathematics.greatestCommonDivisor(group)mathematics.leastCommonMultiple(group)mathematics.maximum(group)mathematics.mean(group)mathematics.median(group)mathematics.minimum(group)mathematics.permutation(n, k)mathematics.ratio(group)nestify(item)randomIndex(item)removeANSIEscapeCodes(item)removeDuplicate(item)replaceholder(list, item, option?)reverseIndex(item)stringOverflow(item, maximumLength, option?)stringParse(item, fuzziness?)
Function (Asynchronous)
waitTime(timeout, ...passThrough?)
Example (Excerpt)
let array1 = ["one", "two", "three"];
let array2 = ["one", "two", "three"];
console.log(Array.reverse(array1));
// ["three", "two", "one"]
console.log(array1);
// ["three", "two", "one"]
console.log(moreMethod.reverseIndex(array2));
// ["three", "two", "one"]
console.log(array2);
// ["one", "two", "three"]
let array3 = moreMethod.concatenate(array1, array2);
console.log(array3);
// ["three", "two", "one", "one", "two", "three"]
console.log(moreMethod.removeDuplicate(array3));
// ["three", "two", "one"]