Package Exports
- my-lib
- my-lib/dist/myLib.js
- my-lib/module/myLib.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (my-lib) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
my-lib
Library of recurring, unconnected but pure functions
Install and usage
Install the package as npm package. Provided are a umd-formatted file in the dist folder to require or to just load
<script src="../../node_modules/dist/myLib.js"></script>
<script src="https://unpkg.com/my-lib@latest"></script>and an es-module in the module folder to import the separate functions or to import all
import { isAlphaNumeric } from 'my-lib'
import * as myLib from 'my-lib'API
arrayCombination(array1, array2)
Find unique values from both arrays
Parameters
array1(unknown[])array2(unknown[])
Return type
the combination
unknown[]arrayFromCommaSeparatedList(commaSeparatedList)
Process comma separated list to a sanitised array with normalised strings
Parameters
commaSeparatedList(string)
Return type
array with separate strings
string[]arrayFromQuery(cssQuery)
Create a genuine array from a css-query
Parameters
cssQuery(string)
Return type
array with Elements
Node[]arrayIntersection(array1, array2)
Find unique values appearing in both arrays
Parameters
array1(any[])array2(any[])
Return type
the intersection
unknown[]deepClone(variable)
Recursively copy all indivisible data to new object Pay attention to Date and RegExp objects
Parameters
variable(any)
Return type
the same data with different references
anyforceStringify(value)
Try generic ways to produce a string, an empty string if necessary
Parameters
value(any)
Return type
string represention of anything
stringgreet()
The sake of package; log the console
Return type
voidhasOwnProperty(object, prop)
Check for existence of property in object
Parameters
object(Record<string, unknown>)prop(string)
Return type
the object has the property as its own property -- not inheriting it
booleanisAlphaNumeric(word)
Test for being a string consisting of letters and/or digits, for being undelimited
Parameters
word(string)
Return type
consists of letters and/or digits only
booleanisAttachedToDom(elm)
Check node for being part of the DOM
Parameters
elm(Element)
Return type
true when the node is on the webpage
booleanisChar(char)
Test value for being a character; a string with a length of one
Parameters
char(string)
Return type
is a single character
booleanisDigit(char)
Test value for being a string representation of a digit
Parameters
char(string)
Return type
is a number 0-9
booleanisEqualSigns(...nums)
Check all arguments for being a number with the same sign (Zero is sign-neutral)
Parameters
nums(number[])
Return type
equality
booleanisExactMatch(word, regex)
Check for a match covering the string entirely
Parameters
word(string)regex(RegExp)
Return type
all characters of the word were described in regex
booleanisFundamental(value)
Check value for indivisible: string, number, boolean, bigint, symbol, undefined, null, function
Parameters
value(unknown)
Return type
booleanisLetter(char)
Test value for being a letter
Parameters
char(string)
Return type
char is a letter
booleanisLower(char)
Test value for being a lowercase letter
Parameters
char(string)
Return type
char is a lower-case letter
booleanisPrimitive(value)
Check value for being a primitive but leave out the anti-value undefined;
Parameters
value(unknown)
Return type
is a primitive
booleanisUpper(char)
Test value for being an uppercase letter
Parameters
char(string)
Return type
char is a upper-case letter
booleanisUsableNumber(...nums)
Test for values with which calculations can be done
Parameters
nums(number[])
Return type
every argument is a usable number
booleanisWrappedPrimitive(value)
Check the variable for living in an object wrapper These can be generated by new String / Number etc. see https://developer.mozilla.org/en-US/docs/Glossary/Primitive
Parameters
value(unknown)
Return type
is a wrapped primitive
booleanmathAvg(seq)
Calculate average of array with Numbers
Parameters
seq(number[])
Return type
the average of the numbers
numbermathSum(seq)
Calculate sum of array with Numbers
Parameters
seq(number[])
Return type
the sum of the numbers
numberroundAtDecimals(origin, decimals)
Round at decimals
Parameters
origin(number)decimals(number)
Return type
the rounded number
numberroundAtDigits(origin, digits)
Round at digits; round with significance
Parameters
origin(number)digits(number)
Return type
the rounded number
numberroundAtDigitsExponent(origin, digits)
Round at digits to exponential notation; round with significance
Parameters
origin(number)digits(number)
Return type
the rounded number as exponent
stringstringify(value)
Convert anything to a string, an empty string if necessary. Expect sensible but not consistent cross-environment behaviour on functions.
Parameters
value(any)
Return type
string represention of anything
string