ku4es-kernel

kodmunki Utilities for ECMAScript Kernel

Usage no npm install needed!

<script type="module">
  import ku4esKernel from 'https://cdn.skypack.dev/ku4es-kernel';
</script>

README

Classes

Assert
Name
Rolodex
DayPoint
Money
Coord
Interval
Timeout

Objects

math : object
regex : object
string : object

Functions

deduplicate(array)Array
debounce(func, wait, [immediate])function
feature(policy, method)*
opt(method, value)*
nextTick(func)number
wait(timeout)Promise.<any>

Assert

Kind: global class
Summary: Encapsulates common assertions providing a clear API.

Assert.isNull(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is null.

Param Type Description
value * value to test

Assert.isEmpty(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is an empty string, empty array, or empty object literal.

Param Type Description
value * value to test

Assert.isUndefined(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is undefined.

Param Type Description
value * value to test

Assert.isZero(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is zero.

Param Type Description
value * value to test

Assert.exists(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if value is null or undefined.

Param Type Description
value * value to test

Assert.isNullOrEmpty(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if value not {exists} or {isEmpty}.

Param Type Description
value * value to test

Assert.isArray(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is an Array.

Param Type Description
value * value to test

Assert.isBool(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is a boolean.

Param Type Description
value * value to test

Assert.isTrue(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is true.

Param Type Description
value * value to test

Assert.isFalse(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is false.

Param Type Description
value * value to test

Assert.isDate(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is a Date.

Param Type Description
value * value to test

Assert.isNumber(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is a number.

Param Type Description
value * value to test

Assert.isEven(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if value is a number and is even.

Param Type Description
value * value to test

Assert.isOdd(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if value is a number and is odd.

Param Type Description
value * value to test

Assert.isString(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is a string.

Param Type Description
value * value to test

Assert.isFunction(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is a function. Note: AsyncFunction will also return true for this check. It is advisable to check first for AsyncFunction, then for Function where you may be expecting either.

Param Type Description
value * value to test

Assert.isAsyncFunction(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is a function.

Param Type Description
value * value to test

Assert.isPromise(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is a Promise.

Param Type Description
value * value to test

Assert.isObject(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is an Object.

Param Type Description
value * value to test

Assert.isObjectLiteral(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if and only if value is an object literal.

Param Type Description
value * value to test

Assert.isTruthy(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if value is not {isFalsy}.

Param Type Description
value * value to test

Assert.isFalsy(value) ⇒ boolean

Kind: static method of Assert
Summary: Returns true if value {isZero}, {isFalse}, {isNullOrEmpty}, or {isNaN}.

Param Type Description
value * value to test

Name

Kind: global class
Summary: A person's proper name

new Name(first, middle, last)

Param Type
first string
middle string
last string

name.first ⇒ string

Kind: instance property of Name
Summary: First name.
Access: public

name.middle ⇒ string

Kind: instance property of Name
Summary: Middle name.
Access: public

name.last ⇒ string

Kind: instance property of Name
Summary: Last name.
Access: public

name.full ⇒ string

Kind: instance property of Name
Summary: Space delimited first, [middle] and last name.
Access: public

name.initials ⇒ string

Kind: instance property of Name
Summary: Initials delimited by '.'.
Access: public

name.equals(other) ⇒ boolean

Kind: instance method of Name
Summary: Returns true if this is equal to another Name.
Access: public

Param Type
other Name

name.toString([format]) ⇒ string

Kind: instance method of Name
Access: public

Param Type Description
[format] string An optional format that can include: F, M, L, f, m, l where F, M, L represent the first, middle, and last name values respectively, and f, m, l represent the first initial, middle initial, and last initial respectively.
Example: new Name('John', 'Bob', 'Doe').toString('F m. L') === 'John B. Doe'

Rolodex

Kind: global class
Summary: Serially traverses an array forward and backward.

new Rolodex(list)

Param Type Description
list Array An array of items to manage.

rolodex.isEmpty ⇒ boolean

Kind: instance property of Rolodex
Summary: Returns true if is empty.
Access: public

rolodex.index ⇒ boolean

Kind: instance property of Rolodex
Summary: Returns true if is empty.
Access: public

rolodex.length ⇒ number

Kind: instance property of Rolodex
Summary: Returns number of values in the Rolodex.
Access: public

rolodex.current ⇒ *

Kind: instance property of Rolodex
Summary: Returns current value at Rolodex head.
Access: public

rolodex.next ⇒ *

Kind: instance property of Rolodex
Summary: Advance the head of the Rolodex one position moving to the zero index if at the last index and return that value.
Access: public

rolodex.prev ⇒ *

Kind: instance property of Rolodex
Summary: Recede the head of the Rolodex one position moving to the last index if at the zero index and return that value.
Access: public

rolodex.peekNext ⇒ *

Kind: instance property of Rolodex
Summary: Return the next value without moving the head.
Access: public

rolodex.peekPrev ⇒ *

Kind: instance property of Rolodex
Summary: Return the previous value without moving the head.
Access: public

DayPoint

Kind: global class
Summary: Date utility class.

new DayPoint(year, month, date)

Param Type Description
year number a valid year.
month number a valid month (1-12) where 1 = January and 12 = December.
date number a valid date for a given month.

dayPoint.value ⇒ number

Kind: instance property of DayPoint
Summary: Returns value.
Access: public

dayPoint.day ⇒ number

Kind: instance property of DayPoint
Summary: Returns day.
Access: public

dayPoint.date ⇒ number

Kind: instance property of DayPoint
Summary: Returns date.
Access: public

dayPoint.month ⇒ number

Kind: instance property of DayPoint
Summary: Returns month.
Access: public

dayPoint.year ⇒ number

Kind: instance property of DayPoint
Summary: Returns year.
Access: public

dayPoint.shortYear ⇒ number

Kind: instance property of DayPoint
Summary: Returns a truncated two digit year.
Access: public

dayPoint.isWeekday ⇒ boolean

Kind: instance property of DayPoint
Summary: Returns true for days Monday-Friday.
Access: public

dayPoint.isWeekend ⇒ boolean

Kind: instance property of DayPoint
Summary: Returns true for days Saturday and Sunday
Access: public

dayPoint.isLeapYear ⇒ boolean

Kind: instance property of DayPoint
Summary: Returns true for years that have a February 29th date.
Access: public

dayPoint.nextDay ⇒ DayPoint

Kind: instance property of DayPoint
Summary: Returns the day following this day.
Access: public

dayPoint.prevDay ⇒ DayPoint

Kind: instance property of DayPoint
Summary: Returns the day preceding this day.
Access: public

dayPoint.nextMonth ⇒ DayPoint

Kind: instance property of DayPoint
Summary: Returns the month following this month.
Warning: This method will error when navigating to next months that do not include a current day.
Access: public

dayPoint.prevMonth ⇒ DayPoint

Kind: instance property of DayPoint
Summary: Returns the month preceding this month.
Warning: This method will error when navigating to previous months that do not include a current day.
Access: public

dayPoint.nextYear ⇒ DayPoint

Kind: instance property of DayPoint
Summary: Returns the month following this month.
Warning: This method will error when navigating to next years that do not include a current day.
Access: public

dayPoint.prevYear ⇒ DayPoint

Kind: instance property of DayPoint
Summary: Returns the month preceding this month.
Warning: This method will error when navigating to previous years that do not include a current day.
Access: public

dayPoint.firstDayOfMonth ⇒ DayPoint

Kind: instance property of DayPoint
Summary: Returns the first day of this month and year.
Access: public

dayPoint.lastDayOfMonth ⇒ DayPoint

Kind: instance property of DayPoint
Summary: Returns the last day of this month and year.
Access: public

dayPoint.add(years, months, days) ⇒ DayPoint

Kind: instance method of DayPoint
Summary: Returns a DayPoint modified by the number of years, months, and days passed.
Access: public

Param Type Description
years number The number of years to add or subtract from this DayPoint.
months number The number of months to add or subtract from this DayPoint.
days number The number of days to add or subtract from this DayPoint.

dayPoint.isBefore(other) ⇒ boolean

Kind: instance method of DayPoint
Summary: Returns true if the other DayPoint is before this DayPoint.
Access: public

Param Type Description
other DayPoint DayPoint to compare.

dayPoint.isAfter(other) ⇒ boolean

Kind: instance method of DayPoint
Summary: Returns true if the other DayPoint is after this DayPoint.
Access: public

Param Type Description
other DayPoint DayPoint to compare.

dayPoint.equals(other) ⇒ boolean

Kind: instance method of DayPoint
Summary: Returns true if the other DayPoint is equal to this DayPoint.
Access: public

Param Type Description
other DayPoint DayPoint to compare.

dayPoint.toString(formatString) ⇒ string

Kind: instance method of DayPoint
Summary: Returns a date string formatted per the passed format string.
Access: public

Param Type Default Description
formatString string "mm/dd/yyyy" format string where m = month, d = date, y = year.
Example: For date, January, 12, 2018, 'mm/dd/yy' -> '01/12/18' & 'dd/mm/yyyy' -> '12/01/2018'.

dayPoint.toDate() ⇒ Date

Kind: instance method of DayPoint
Summary: Returns a Date value of this.
Access: public

dayPoint.toJson() ⇒ string

Kind: instance method of DayPoint
Summary: Returns a JSON string value of this.
Access: public

DayPoint.today ⇒ DayPoint

Kind: static property of DayPoint
Summary: Returns a DayPoint with value now.
Access: public

DayPoint.canParse(value) ⇒ boolean

Kind: static method of DayPoint
Summary: Returns true if the value can be successfully parsed.
Access: public

Param Type Description
value string A string value to test.

DayPoint.parse(value) ⇒ DayPoint

Kind: static method of DayPoint
Summary: Returns a DayPoint with the parsed value of the passed value.
Warning: this method will throw an error for values that cannot be parsed.
Access: public

Param Type
value string

DayPoint.tryParse(value) ⇒ DayPoint | null

Kind: static method of DayPoint
Summary: Returns a DayPoint with the parsed value of the passed value. Note: Will return null for values that cannot be parsed.
Access: public

Param Type
value string

DayPoint.assumeNow(dayPoint)

Kind: static method of DayPoint
Summary: Sets the concept of now to the passed value instead of using now as defined by the system clock.
Access: public

Param Type
dayPoint DayPoint

Money

Kind: global class

new Money(amount, [currency])

Param Type
amount number
[currency] string

money.cents ⇒ number

Kind: instance property of Money
Summary: Returns cents.
Access: public

money.dollars ⇒ number

Kind: instance property of Money
Summary: Returns dollars.
Access: public

money.currency ⇒ number

Kind: instance property of Money
Summary: Returns currency.
Access: public

money.value ⇒ number

Kind: instance property of Money
Summary: Returns value.
Access: public

money.nearestWhole ⇒ Money

Kind: instance property of Money
Summary: Returns Money rounded to the nearest whole value.
Access: public

money.nearestDollar ⇒ Money

Kind: instance property of Money
Summary: Returns a Money rounded to the nearest whole value. _Note: This property is simply an API for common US usage.
Access: public

money.add(other) ⇒ Money

Kind: instance method of Money
Summary: Returns the sum two Moneys.
Warning: will throw an error for dissimilar currencies. Use isOfCurrency to check currencies and exchange as necessary.
Access: public

Param Type Description
other Money {Money} of currency to add to this

money.subtract(other) ⇒ Money

Kind: instance method of Money
Summary: Returns the difference two Moneys.
Warning: will throw an error for dissimilar currencies. Use isOfCurrency to check currencies and exchange as necessary.
Access: public

Param Type
other Money

money.multiply(factor) ⇒ Money

Kind: instance method of Money
Summary: Returns the product of this multiplied by factor
Access: public

Param Type
factor number

money.divide(divisor) ⇒ Money

Kind: instance method of Money
Summary: Returns the quotient of this divided by divisor.
Access: public

Param Type
divisor number

money.equals(other) ⇒ boolean

Kind: instance method of Money
Summary: Returns true if this and another Money have equal values and currencies.
Access: public

Param Type
other Money

money.isGreaterThan(other) ⇒ boolean

Kind: instance method of Money
Summary: Returns true if this value is greater than another Money of the same currency's value.
Access: public

Param Type
other Money

money.isLessThan(other) ⇒ boolean

Kind: instance method of Money
Summary: Returns true if this value is less than another Money of the same currency's value.
Access: public

Param Type
other Money

money.round([to]) ⇒ Money

Kind: instance method of Money
Summary: Returns a Money rounded to the nearest tens exponent.
Access: public

Param Type Description
[to] number tens exponent to round to.

money.roundDown([to]) ⇒ Money

Kind: instance method of Money
Summary: Returns a Money rounded down to the nearest tens exponent.
Access: public

Param Type Description
[to] number tens exponent to round to.

money.roundUp([to]) ⇒ Money

Kind: instance method of Money
Summary: Returns a Money rounded up to the nearest tens exponent.
Access: public

Param Type Description
[to] number tens exponent to round to.

money.exchange(rate, currency) ⇒ Money

Kind: instance method of Money
Summary: Returns a Money with type currency and value calculated over the passed rate of exchange.
Access: public

Param Type Description
rate number rate of exchange
currency string symbol for target currency

money.isOfCurrency(other) ⇒ boolean

Kind: instance method of Money
Summary: Returns true if the target Money is of the same currency.
Access: public

Param Type Description
other Money other Money

money.toString([format], [delimiter]) ⇒ string

Kind: instance method of Money
Summary: Returns a string representation of this formatted to the passed format, where format follows the following rules:
<wholeValue(d)><decimalCharacter(.|,)><fractionalValue(c)><numberOfFractionalValues(_)>
Example: for money with value 1234.5678 and currency 'C', d,c2 would return 'C1.234,56'
Access: public

Param Type Default Description
[format] string "d.c2" format string.
[delimiter] string a 1000x grouping delimiter.

Money.zero(currency) ⇒ Money

Kind: static method of Money
Summary: Returns Money with a zero value.
Access: public

Param Type
currency string

Money.isMoney(other) ⇒ boolean

Kind: static method of Money
Summary: Returns true if other is an instance of Money.
Access: public

Param Type Description
other * value to test

Money.canParse(value) ⇒ boolean

Kind: static method of Money
Summary: Returns true if value can be parsed to Money.
Access: public

Param Type
value *

Money.parse(value) ⇒ Money

Kind: static method of Money
Summary: Returns Money with value and currency calculated from passed value if value can be parsed into Money. Otherwise will throw an error.
Access: public

Param Type Description
value * value to parse to Money

Money.tryParse(value) ⇒ Money

Kind: static method of Money
Summary: Returns Money with value and currency calculated from passed value if value can be parsed into Money, otherwise null.
Access: public

Param Type Description
value * value to parse to Money

Coord

Kind: global class
Summary: Coordindate

new Coord(x, y)

Param Type
x number
y number

coord.x ⇒ number

Kind: instance property of Coord
Summary: x value.
Access: public

coord.y ⇒ number

Kind: instance property of Coord
Summary: y value.
Access: public

coord.value ⇒ Object

Kind: instance property of Coord
Summary: Returns an object containing the x and y values.
Access: public

coord.half ⇒ Coord

Kind: instance property of Coord
Summary: Returns a Coord with value half of this Coord.
Access: public

coord.abs ⇒ Coord

Kind: instance property of Coord
Summary: Returns a Coord with absolute value of this Coord.
Access: public

coord.equals(other) ⇒ boolean

Kind: instance method of Coord
Summary: Returns true if this equals other.
Access: public

Param Type
other Coord

coord.add(other) ⇒ Coord

Kind: instance method of Coord
Summary: Returns a Coord whose value is the sum of this and other.
Access: public

Param Type
other Coord

coord.subtract(other) ⇒ Coord

Kind: instance method of Coord
Summary: Returns a Coord whose value is the difference of this and other.
Access: public

Param Type
other Coord

coord.multiply(other) ⇒ Coord

Kind: instance method of Coord
Summary: Returns a Coord whose value is the product of this and other.
Access: public

Param Type
other Coord

coord.divide(other) ⇒ Coord

Kind: instance method of Coord
Summary: Returns a Coord whose value is the quotient of this and other.
Access: public

Param Type
other Coord

coord.round(toNearest) ⇒ Coord

Kind: instance method of Coord
Summary: Returns a Coord whose value is this rounded to nearest tens exponent.
Access: public

Param Type Default
toNearest number 0

coord.toString() ⇒ string

Kind: instance method of Coord
Summary: Returns string value.
Access: public

Coord.canParse(value) ⇒ boolean

Kind: static method of Coord
Summary: Returns true if the value can be successfully parsed.
Access: public

Param Type Description
value string A string value to test.

Coord.parse(obj) ⇒ Coord

Kind: static method of Coord
Summary: Returns a Coord with the parsed value of the passed value.
Warning: this method will throw an error for values that cannot be parsed.
Access: public

Param Type
obj Object

Coord.tryParse(obj) ⇒ Coord | null

Kind: static method of Coord
Summary: Returns a Coord with the parsed value of the passed value. Note: Will return null for values that cannot be parsed.
Access: public

Param Type
obj Object

Interval

Kind: global class
Summary: encapsulates timer boilerplate

new Interval(milliseconds)

Param Type
milliseconds number

interval.isRunning ⇒ boolean

Kind: instance property of Interval
Summary: Returns true if this Interval is running.
Access: public

interval.onInterval() ⇒ this

Kind: instance method of Interval
Summary: Sets method to call on interval.
Access: public

Param Type
method. function

interval.start() ⇒ this

Kind: instance method of Interval
Summary: Starts timer.
Access: public

interval.clear() ⇒ this

Kind: instance method of Interval
Summary: Clears timer.
Access: public

Timeout

Kind: global class
Summary: encapsulates timer boilerplate

new Timeout(milliseconds)

Param Type
milliseconds number

timeout.isRunning ⇒ boolean

Kind: instance property of Timeout
Summary: Returns true if this Timeout is running.
Access: public

timeout.onTimeout() ⇒ this

Kind: instance method of Timeout
Summary: Sets method to call on timeout.
Access: public

Param Type
method. function

timeout.start() ⇒ this

Kind: instance method of Timeout
Summary: Starts timer.
Access: public

timeout.clear() ⇒ this

Kind: instance method of Timeout
Summary: Clears timer.
Access: public

math : object

Kind: global namespace

math.random([min], [max]) ⇒ number

Kind: static method of math
Summary: Returns a random value between 0 and 1 by default. Will return a random number between a min an max value if passed.

Param Type Description
[min] number random number will not precede this value.
[max] number random number will not exceed this value.

math.round(value, toNearest) ⇒ number

Kind: static method of math
Summary: Rounds a value to the nearest tens exponent.

Param Type
value number
toNearest number

math.roundUp(value, toNearest) ⇒ number

Kind: static method of math
Summary: Rounds a value up to the nearest tens exponent.

Param Type
value number
toNearest number

math.roundDown(value, toNearest) ⇒ number

Kind: static method of math
Summary: Rounds a value down to the nearest tens exponent.

Param Type
value number
toNearest number

math.roundTowardZero(value, toNearest) ⇒ number

Kind: static method of math
Summary: Rounds a value toward zero to the nearest tens exponent.

Param Type
value number
toNearest number

math.gcd(a, b) ⇒ number

Kind: static method of math
Summary: Returns the greatest common denominator for arguments a and b.

Param Type
a number
b number

math.fib(n) ⇒ number

Kind: static method of math
Summary: Returns the nth number in a Fibonacci set.
Note: zero indexed.
Warning: Due to this function's attempt at leveraging tail-calls it can cause stack overflows for large values of n.

Param Type Description
n number index.

math.fib2(n) ⇒ number

Kind: static method of math
Summary: Returns the nth number in a Fibonacci set.
Note: zero indexed.
Warning: This function has better performance and is not prone to stack overflows as is fib.

Param Type Description
n number index.

math.fibArray(n) ⇒ number

Kind: static method of math
Summary: Returns an array of length n with Fibonacci values.
Warning: Due to this function's attempt at leveraging tail-calls it can cause stack overflows for large values of n.

Param Type Description
n number length.

math.fibArray2(n) ⇒ number

Kind: static method of math
Summary: Returns an array of length n with Fibonacci values.
Warning: This function has better performance and is not prone to stack overflows as is fibArray.

Param Type Description
n number length.

math.tryParseInt(value, valueIfNan) ⇒ number

Kind: static method of math
Summary: Returns a parsed integer value for values that can be parsed, or a set value if passed, or zero.

Param Type Description
value string value to parse.
valueIfNan number value to return if {value} cannot be parsed.

math.tryParseFloat(value, valueIfNan) ⇒ number

Kind: static method of math
Summary: Returns a parsed float value for values that can be parsed, or a set value if passed, or zero.

Param Type Description
value string value to parse.
valueIfNan number value to return if {value} cannot be parsed.

regex : object

Kind: global namespace

regex.alpha : RegExp

Kind: static constant of regex

regex.alphaNumeric : RegExp

Kind: static constant of regex

regex.base64 : RegExp

Kind: static constant of regex

regex.dataUrl : RegExp

Kind: static constant of regex

regex.email : RegExp

Kind: static constant of regex

regex.empty : RegExp

Kind: static constant of regex

regex.numeric : RegExp

Kind: static constant of regex

regex.script : RegExp

Kind: static constant of regex

regex.uid : RegExp

Kind: static constant of regex

regex.url : RegExp

Kind: static constant of regex

regex.uuid : RegExp

Kind: static constant of regex

regex.debounce(regex) ⇒ string

Kind: static method of regex
Summary: Converts a RegExp to a Regular Expression pattern string.
Returns: string - - Regular Expression pattern

Param Type Description
regex RegExp RegExp to convert to pattern

regex.escape(string) ⇒ string

Kind: static method of regex

Param Type Description
string string A regex string to escape for using in RegExp(string)

string : object

Kind: global namespace

string.exports.build(rest) ⇒ string

Kind: static method of string
Summary: Builds a string from string arguments.

Param
rest

string.exports.chunk(string, size) ⇒ Array.<string>

Kind: static method of string
Summary: Returns an array of substring strings of size.

Param Type Description
string string the string value to chunk.
size number the size of each chunk.

string.exports.format(format, rest) ⇒ string

Kind: static method of string
Summary: Returns a string template filled with passed values.

Param Type Description
format string String format in the form "${0} indexed ${1}."
rest string Value arguments e.g. "Zero", "arguments"

string.exports.trim(string) ⇒ string

Kind: static method of string
Summary: Returns a string with leading and trailing whitespace trimmed.

Param
string

string.exports.trimStart(string) ⇒ string

Kind: static method of string
Summary: Returns a string with leading whitespace trimmed.

Param
string

string.exports.trimEnd(string) ⇒ string

Kind: static method of string
Summary: Returns a string with trailing whitespace trimmed.

Param
string

string.exports.capitalize(string) ⇒ string

Kind: static method of string
Summary: Returns a string with the first character capitalized.

Param
string

string.exports.mask(string, template, [char]) ⇒ string

Kind: static method of string
Summary: Returns a string masked over the passed template.

Param Type Description
string string String to mask
template string | function Mask template
[char] string Mask character in template defaults to '_'.

string.exports.unmask(string, template, [char]) ⇒ string

Kind: static method of string
Summary: Returns a string unmasked over the passed template.

Param Type Description
string string String to unmask
template string | function Mask template
[char] string Mask character in template defaults to '_'.

deduplicate(array) ⇒ Array

Kind: global function
Summary: Returns a new array with values of input array having duplicates removed.

Param Type
array Array

debounce(func, wait, [immediate]) ⇒ function

Kind: global function
Summary: Returns a debounced function per the function and wait passed

Param Type Description
func function The function to debounce.
wait number The time to wait between calls of func.
[immediate] boolean True if func should be called immediately.

feature(policy, method) ⇒ *

Kind: global function
Summary: Feature flag that takes a feature policy and a method and will call the method IFF the policy value is or returns true.

Param Type
policy boolean | function | Promise
method function

opt(method, value) ⇒ *

Kind: global function
Summary: returns that return value of the passed method or the value if the passed method throws an error.

Param Type Description
method function method to execute.
value * Value to return if method fails.

opt.async(method, value) ⇒ *

Kind: static method of opt
Summary: returns that return value of the passed method or the value if the passed method throws an error.

Param Type Description
method AsyncFunction | Promise method to execute.
value * Value to return if method fails.

nextTick(func) ⇒ number

Kind: global function
Summary: Postpones function execution until the next event loop.

Param Type Description
func function function to move to the next event loop

wait(timeout) ⇒ Promise.<any>

Kind: global function
Summary: A promisified setTimeout.

Param Type Description
timeout number the number of milliseconds to wait