@hugoalh/more-method

A module to provide more method.

Usage no npm install needed!

<script type="module">
  import hugoalhMoreMethod from 'https://cdn.skypack.dev/@hugoalh/more-method';
</script>

README

More Method (NodeJS)

MoreMethod.NodeJS GitHub Contributors GitHub Issues GitHub Pull Requests GitHub Discussions GitHub Stars GitHub Forks GitHub Languages CodeFactor Grade LGTM Alerts LGTM Grade License

Release Latest (GitHub Latest Release Date) Pre (GitHub Latest Pre-Release Date)
GitHub GitHub Total Downloads GitHub Latest Release Version GitHub Latest Pre-Release Version
NPM NPM Total Downloads NPM Latest Release Version NPM Latest Pre-Release Version

📝 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-method

Use 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"]