README.md
 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 isObject = require('es-object-atoms/isObject');
19  const ToObject = require('es-object-atoms/ToObject');
20  const RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible');
21  
22  assert.equal($Object, Object);
23  assert.throws(() => ToObject(null), TypeError);
24  assert.throws(() => ToObject(undefined), TypeError);
25  assert.throws(() => RequireObjectCoercible(null), TypeError);
26  assert.throws(() => RequireObjectCoercible(undefined), TypeError);
27  
28  assert.equal(isObject(undefined), false);
29  assert.equal(isObject(null), false);
30  assert.equal(isObject({}), true);
31  assert.equal(isObject([]), true);
32  assert.equal(isObject(function () {}), true);
33  
34  assert.deepEqual(RequireObjectCoercible(true), true);
35  assert.deepEqual(ToObject(true), Object(true));
36  
37  const obj = {};
38  assert.equal(RequireObjectCoercible(obj), obj);
39  assert.equal(ToObject(obj), obj);
40  ```
41  
42  ## Tests
43  Simply clone the repo, `npm install`, and run `npm test`
44  
45  ## Security
46  
47  Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
48  
49  [package-url]: https://npmjs.org/package/es-object-atoms
50  [npm-version-svg]: https://versionbadg.es/ljharb/es-object-atoms.svg
51  [deps-svg]: https://david-dm.org/ljharb/es-object-atoms.svg
52  [deps-url]: https://david-dm.org/ljharb/es-object-atoms
53  [dev-deps-svg]: https://david-dm.org/ljharb/es-object-atoms/dev-status.svg
54  [dev-deps-url]: https://david-dm.org/ljharb/es-object-atoms#info=devDependencies
55  [npm-badge-png]: https://nodei.co/npm/es-object-atoms.png?downloads=true&stars=true
56  [license-image]: https://img.shields.io/npm/l/es-object-atoms.svg
57  [license-url]: LICENSE
58  [downloads-image]: https://img.shields.io/npm/dm/es-object.svg
59  [downloads-url]: https://npm-stat.com/charts.html?package=es-object-atoms
60  [codecov-image]: https://codecov.io/gh/ljharb/es-object-atoms/branch/main/graphs/badge.svg
61  [codecov-url]: https://app.codecov.io/gh/ljharb/es-object-atoms/
62  [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-object-atoms
63  [actions-url]: https://github.com/ljharb/es-object-atoms/actions