0.0.3 • Published 2 years ago

@r146023/colemen-jsutils v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

A simple javascript utility library

Essentially just a library of methods that I use frequently.

Usage

npm i @r146023/colemen-jsutils

# import
import utils from 'colemen-jsutils';

Start coding! package.json and entry files are already set up for you, so don't worry about linking to your main file, typings, etc. Just keep those files with the same name.

arrayUtils

arrayUtils.Flatten

Flattens an array to a single level of depth

  • author: Colemen Atwood
  • created: 01\11\2022 10:16:00
  • memberOf: arrayUtils#
  • version: 1.0

arguments

  • {array} array - The array to flatten\
  • {boolean} allowDuplicates=true - If false, only unique elements are kept

return {array} \ The formatted array.

===============================================================

arrayUtils.stripDuplicates

Remove duplicate values from an array

  • author: Colemen Atwood
  • created: 01\11\2022 10:16:00
  • memberOf: arrayUtils#
  • version: 1.0

arguments \ {array} a - The array to format

return {array}\ The formatted array

===============================================================

arrayUtils.isEmpty

Checks if an array is empty,null,false or undefined.

  • author: Colemen Atwood
  • created: 01\10\2022 17:09:25
  • memberOf: arrayUtils#
  • version: 1.0

arguments \ {array} a - The array to validate.

return {boolean|null}\ True if the array is empty,null,false or undefined. False if it is not empty. Null if the array is not an array.

===============================================================

arrayUtils.longestStringInArray

Finds the longest string in an array of strings.

  • author: Colemen Atwood
  • created: 01\10\2022 13:52:30
  • memberOf: arrayUtils#
  • version: 1.0

arguments \ {string} aVal - The array to parse.

return {number}\ The length of the longest string in the array.

===============================================================

Features

  • arrayUtils

    • flattenArray
    • stripDuplicates
    • isEmpty
    • longestStringInArray
    • divideArray
  • beaconUtils

    • newBeacon
  • browserUtils

    • generalData
    • localStorage
    • sessionStorage
    • canvasSupported
  • colorUtils

    • randomColor
    • hexToRgb
    • randomConsoleColor
  • componentUtils

    • genClasses
    • compHasTypeName
    • compHasPropKey
    • getAllChildren
    • getUnknownChildren
    • getChildByProp
    • countChildren
  • convertUtils

    • toBoolean
    • toString
    • base64ToUTF8
    • hash
      • MD5
      • SHA1
      • SHA256
      • SHA512
      • RIPEMD160
  • cookieUtils

    • set
    • get
    • remove
  • encryptUtils

    • encryptAES
    • decryptAES
  • generateUtils

    • variations
    • generateTypos
    • randomint
    • randomString
    • randomColor
    • UUID
  • localStorageUtils

    • getAllKeys
    • set
    • get
    • remove
    • clear

Importing library

You can import the generated bundle to use the whole library generated by this starter:

import myLib from 'mylib'

Additionally, you can import the transpiled modules from dist/lib in case you have a modular library:

import something from 'mylib/dist/lib/something'