Sugar Sugar

Sugar is a Javascript utility library. It lets you do stuff like this:

users.sum('votes');
users.average('profile.likes');
users.max('profile.likes');
Date.create('last week Friday');
may.relative();
longText.truncate(26);
(15432).abbr(1)

Simple

A straightforward API makes Sugar very easy to pick up and start using.

Modular

Custom builds and modularized npm packages let you use only what you need.

Extensible

Users can define methods or use plugins to handle specialized use cases.

Dates

The date module parses, formats, and manipulates dates and supports many locales.

Natives

Sugar blends in with native methods, and defers to their implementations when possible.

Polyfills

A comprehensive polyfill suite patches browser support when it is broken or missing.

Does Sugar modify natives?

As of v2.0, native extension has become opt-in while supporting two new ways of interacting with the library. Sugar still believes in the safe extension of natives, however there are times when this is not appropriate, and this choice is now put in the hands of the user.

Learn More: