0.0.4 • Published 11 months ago

kariu-utils v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

kariu-utils

Basics:

npm i kariu-utils

How to use:

import { functionName } from kariu-utils

Example:

import { array, string, dom, math } from 'kariu-utils';
console.log(string.toBoolean('true'));

array functions:

  1. useFilter(arrayOfObject, filterKeys, allFilterKeys = [] ) : This function will filter your array of objects and return a new one.
  • arrayOfObject: your array to filter.
  • filterKeys: your object of filters. ex: { search: 'plop', id: 5, 8, 9}. The keyword "search" will look for string within the allFilterKeys param if given or your entire array.

  • allFilterKeys: optional. if given, will only filter within given range.

  1. useSort(array, key, order): The function will sort your array according to your desire.

string functions:

  1. capitalize(string): ex : string.capitalise('test') => Test.
  2. getByteLength(string)
  3. isJson(string)
  4. isEmail(string)
  5. removeAccents(string)
  6. removeSpecialChar(string)
  7. replaceWhiteSpaces(string, replacement: string)
  8. toBoolean(string)
  9. escapeEmoji(string) => will prevent emoji insertion in your string :)

dom functions:

  1. getPosRelativeTo(refFrom, refToRect)