Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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&ltT&gt