[d565449] | 1 | # es-object-atoms <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
---|
| 2 |
|
---|
| 3 | [![github actions][actions-image]][actions-url]
|
---|
| 4 | [![coverage][codecov-image]][codecov-url]
|
---|
| 5 | [![License][license-image]][license-url]
|
---|
| 6 | [![Downloads][downloads-image]][downloads-url]
|
---|
| 7 |
|
---|
| 8 | [![npm badge][npm-badge-png]][package-url]
|
---|
| 9 |
|
---|
| 10 | ES Object-related atoms: Object, ToObject, RequireObjectCoercible.
|
---|
| 11 |
|
---|
| 12 | ## Example
|
---|
| 13 |
|
---|
| 14 | ```js
|
---|
| 15 | const assert = require('assert');
|
---|
| 16 |
|
---|
| 17 | const $Object = require('es-object-atoms');
|
---|
| 18 | const ToObject = require('es-object-atoms/ToObject');
|
---|
| 19 | const RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible');
|
---|
| 20 |
|
---|
| 21 | assert.equal($Object, Object);
|
---|
| 22 | assert.throws(() => ToObject(null), TypeError);
|
---|
| 23 | assert.throws(() => ToObject(undefined), TypeError);
|
---|
| 24 | assert.throws(() => RequireObjectCoercible(null), TypeError);
|
---|
| 25 | assert.throws(() => RequireObjectCoercible(undefined), TypeError);
|
---|
| 26 |
|
---|
| 27 | assert.deepEqual(RequireObjectCoercible(true), true);
|
---|
| 28 | assert.deepEqual(ToObject(true), Object(true));
|
---|
| 29 |
|
---|
| 30 | const obj = {};
|
---|
| 31 | assert.equal(RequireObjectCoercible(obj), obj);
|
---|
| 32 | assert.equal(ToObject(obj), obj);
|
---|
| 33 | ```
|
---|
| 34 |
|
---|
| 35 | ## Tests
|
---|
| 36 | Simply clone the repo, `npm install`, and run `npm test`
|
---|
| 37 |
|
---|
| 38 | ## Security
|
---|
| 39 |
|
---|
| 40 | Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
|
---|
| 41 |
|
---|
| 42 | [package-url]: https://npmjs.org/package/es-object-atoms
|
---|
| 43 | [npm-version-svg]: https://versionbadg.es/ljharb/es-object-atoms.svg
|
---|
| 44 | [deps-svg]: https://david-dm.org/ljharb/es-object-atoms.svg
|
---|
| 45 | [deps-url]: https://david-dm.org/ljharb/es-object-atoms
|
---|
| 46 | [dev-deps-svg]: https://david-dm.org/ljharb/es-object-atoms/dev-status.svg
|
---|
| 47 | [dev-deps-url]: https://david-dm.org/ljharb/es-object-atoms#info=devDependencies
|
---|
| 48 | [npm-badge-png]: https://nodei.co/npm/es-object-atoms.png?downloads=true&stars=true
|
---|
| 49 | [license-image]: https://img.shields.io/npm/l/es-object-atoms.svg
|
---|
| 50 | [license-url]: LICENSE
|
---|
| 51 | [downloads-image]: https://img.shields.io/npm/dm/es-object.svg
|
---|
| 52 | [downloads-url]: https://npm-stat.com/charts.html?package=es-object-atoms
|
---|
| 53 | [codecov-image]: https://codecov.io/gh/ljharb/es-object-atoms/branch/main/graphs/badge.svg
|
---|
| 54 | [codecov-url]: https://app.codecov.io/gh/ljharb/es-object-atoms/
|
---|
| 55 | [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-object-atoms
|
---|
| 56 | [actions-url]: https://github.com/ljharb/es-object-atoms/actions
|
---|