Sugar is a toolkit that gives you access to a bunch of useful javascript and node functions like querySelectorLive, whenInViewport, whenOutOfViewport, isMobile, isFocusWithin and a lot more…

Principles

Sugar does not import anything unless you explicitely ask for it. This means that you can use only the functions you need without having to import the whole library.

// some DOM related functions
import { __querySelectorLive, __querySelectorUp } from '@lotsof/sugar/dom';

// some "is" related functions
import { __isMobile, __isVisible } from '@lotsof/sugar/is';

// detect some ui related stuffs
import { __whenInViewport, __whenOutOfViewport } from '@lotsof/sugar/dom';

// some crypto related stuffs
import { __base64, __md5, __sha256, __sha512 } from '@lotsof/sugar/crypto';

// some array stuffs
import { __intersection, __unique } from '@lotsof/sugar/array';

// some object stuffs
import {
  __deepMerge,
  __diff,
  __get,
  __objectHash,
  __sortDeep,
} from '@lotsof/sugar/object';

// some string stuffs
import {
  __camelCase,
  __dashCase,
  __dotCase,
  __parse,
  __simplifySpecialChars,
  __unquote,
} from '@lotsof/sugar/string';

// and a lot more to discover by opening
// the documentation using CMD+SHIFT+P shortcut

Start using it

Node/Js

To install the node/js package, simply run:

npm i @lotsof/sugar

PHP

To install the php package, simply run:

composer require lotsof/sugar

Light Light

Light Light

Dark Dark

Dark Dark

Odd World

Odd World