1.10.5 • Published 1 year ago
es5-util v1.10.5
ES5 Utilities
A set of lightweight ES5 Utility functions can be either used in the browser or in Node.js. Heavily inspired by Locutus (formerly php.js), lodash and PHP's Variable and Type Related Extensions
API
arrayColumn(array, columnKey = null, indexKey = null)
castArray(input)
compare(a, b)
compare.upperFirst(a, b)
compare.lowerFirst(a, b)
compare.insensitive(a, b)
findReplace(input, find, replace = '')
getFromObjPath(obj, path)
getKey(object, key)
getKeys(object, path)
getUID(length = 7, characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')
getiUID(length = 7)
getUID16(length = 7)
getValues(object)
hasKey(object, key)
hasKeys(object, path)
inArray(needle, haystack, strict = false)
isArrayLike(input)
isArrayLikeObject(input)
isEmptyLoose(input)
isEmptyStrict(input)
isInteger(input)
isNotEmptyLoose(input)
isNotEmptyStrict(input)
isNotSetLoose(input)
isNotSetStrict(input)
isNotSetTag(input)
isObject(input)
isObjectLike(input)
isPlainObject(input)
isSetLoose(input)
isSetStrict(input)
isSetTag(input)
round(input, precision = 0)
safeParse(input, forceParse = true)
safeStringify(input, replacer = null, space = null, forceParse = false)
substr(input, start, length = null, validatePositions = false)
toArray(input, delimiter = '')
toAssociativeArray(input)
toAssociativeObject(input)
toAssociativeValues(input)
toBytes(input, precision = 2)
toHtmlEntities(input)
toInteger(input)
toLowerCase(input, option = null, preserveCase = true)
toNumber(input, precision = null)
toPlainObject(input)
toString(input, glue = ',', keyGlue = '=')
toTime(str, now)
toUnique(duplicates, strict)
toUnixTime(date = null, preserveJsMs = false)
toUpperCase(input, option = null, preserveCase = true)
truncate(input, length, suffix = '…')
Comparing LoDash's Null/Nil/Empty to ES5 Util's Set/Empty
| LoDash | isNotSet | LDash | isEmpty |
| ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
| Undef | Null | Nil | Strct | Loose | Tag | Empty | Strct | Loose |
| ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
| x | | x | x | x | x | x | x | x | undefined
| | x | x | x | x | x | x | x | x | null
| | | | | x | x | | | x | "undefined"
| | | | | x | x | | | x | "null"
| | | | | | x | x | x | x | ""
| | | | | | | x | x | x | false
| | | | | | | x | x | x | 0
| | | | | | | | x | x | "0"
| | | | | | | | | x | "false"
| | | | | | | x | | | true
| | | | | | | x | | | 1/any non-zero number
| | | | | | | | | | "1"
| | | | | | | | | | "true"/any non-empty string
| | | | | | | x | x | x | []
| | | | | | | | | | [...]/any non-empty array
| | | | | | | x | x | x | {}
| | | | | | | | | | {...}/any non-empty object
| ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
1.10.5
1 year ago
1.10.4
1 year ago
1.10.2
1 year ago
1.9.0
1 year ago
1.8.0
1 year ago
1.7.0
1 year ago
1.10.1
1 year ago
1.10.0
1 year ago
1.6.2
3 years ago
1.6.1
3 years ago
1.6.0
3 years ago
1.5.3
4 years ago
1.5.2
4 years ago
1.5.1
4 years ago
1.5.0
4 years ago
1.4.1
5 years ago
1.4.0
5 years ago
1.3.2
5 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.2
5 years ago
1.2.1
5 years ago
1.2.0
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago