# sugar-core

> Core module for the Sugar Javascript utility library.

Latest version **2.0.6** (published 2018-12-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install sugar-core
pnpm add sugar-core
yarn add sugar-core
bun add sugar-core
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2018-12-05 |
| First published | 2014-04-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 0.8.23 |
| Dependencies | 0 |
| Unpacked size | 255.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4505 |
| Author | Andrew Plummer |
| Maintainers | l_andrew_l |
| Keywords | sugar, sugarjs, functional, browser, utility, util |

## Links

- npm: https://www.npmjs.com/package/sugar-core
- Repository: https://github.com/andrewplummer/Sugar
- Homepage: https://sugarjs.com/
- Issues: https://github.com/andrewplummer/Sugar/issues
- npm.io page: https://npm.io/package/sugar-core

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.0.6 (latest) — 2018-12-05
- 2.0.5 — 2018-12-05
- 2.0.4 — 2016-11-23
- 2.0.3 — 2016-11-23
- 2.0.2 — 2016-11-05
- 2.0.0 — 2016-07-25
- 0.0.1 — 2014-04-20

## README

# sugar-core

This is the core package of the [Sugar](https://github.com/andrewplummer/Sugar)
library. It provides basic behavior as well as the ability to define new methods.
All Sugar npm packages depend on this package. Plugin developers can also depend
on it to define new methods for Sugar plugins.

## Documentation

#### [https://sugarjs.com/docs/](https://sugarjs.com/docs/)

Note: All define methods are called on the global (or exported object in npm),
and accept either a name and a function as two arguments or a single object
mapping names to functions.


## defineStatic

Defines a method to be called on the Sugar global or on a native global in
extended mode.


## defineInstance

Defines a method to be called on the Sugar global or as an instance method on
chainables or native objects in extended mode. All methods should accept the
instance object as their first argument, and should never refer to `this`.


## defineInstanceAndStatic

Defines a method to be called both as an instance and static method. This method
is required for Object methods, which must be defined as both static (as Sugar
will not extend `Object.prototype`) and instance (for chainables). Use this for
any methods intended as Object instance methods.


## defineStaticWithArguments

This method is identical to `defineStatic` except that when methods are called,
they will collect any arguments past `n - 1`, where `n` is the number of
arguments that the method accepts. Collected arguments will be passed to the
method as the last argument defined.


## defineInstanceWithArguments

This method is identical to `defineInstance` except that when methods are
called, they will collect any arguments past `n - 1`, where `n` is the number of
arguments that the method accepts. Collected arguments will be passed to the
method as the last argument defined.


## defineStaticPolyfill

Defines a static method that is mapped onto a native if it does not already
exist. Intended only for creating polyfills that follow the ECMAScript spec.


## defineInstancePolyfill

Defines an instance method that is mapped onto a native prototype if it does not
already exist. Intended only for creating polyfills that follow the ECMAScript
spec. Note that this method differs from `defineInstance` as there is no static
signature (as the method is mapped as-is to the native), so it should refer to
its `this` object.

---
_Source: https://npm.io/package/sugar-core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
