Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/romancow/extra-sugar
Extra methods and definitions for Sugar
https://github.com/romancow/extra-sugar
Last synced: about 1 month ago
JSON representation
Extra methods and definitions for Sugar
- Host: GitHub
- URL: https://github.com/romancow/extra-sugar
- Owner: romancow
- License: mit
- Created: 2018-01-03T20:25:50.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-07-20T16:00:40.000Z (over 2 years ago)
- Last Synced: 2023-06-30T12:02:47.542Z (over 1 year ago)
- Language: TypeScript
- Size: 83 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ExtraSugar
Adds extra native object methods using the [Sugar](https://sugarjs.com/) Javascript utility library. It also corrects and enhances existing Sugar typescript definitions.
## Sugar repo
https://github.com/andrewplummer/Sugar## Methods
### Object
Object.isDefined(obj)
- Returns false if
obj
is undefined, otherwise true. .mapKeys(obj, map, [skipNull])
.cordon(obj, [deep])
.collect(obj, collectFn)
.replace(obj, key, replacer)
.selectValues(obj, keys)
.getWithDefault(obj, key, default, [inherited])
.duplicate(obj, [duplicateFn])
.when(obj, condition, whenFn)
### String
.canBeNumber()
.compare(str)
.splice(start, [deleteCount], [...items])
### Array
Array.ensure(arr, [ignoreNull])
.move(fromIndex, toIndex)
.indexesOf(items)
.sift(search)
.tapEach(eachFn, [context])
.toObject(mapFn)
.indexes()
.normalizeIndex(index, [loop])
.expel(items)
.transpose(items, [missing])
### Function
.isA(classType)
### Boolean
Boolean.parse(value)
### Date
Date.earliest(dates)
Date.latest(dates)
### Range
start
end
## Types
primitive
UnensuredArray<T>