https://github.com/stoplightio/ordered-object-literal
https://github.com/stoplightio/ordered-object-literal
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/stoplightio/ordered-object-literal
- Owner: stoplightio
- License: apache-2.0
- Created: 2020-03-22T20:09:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-16T11:21:27.000Z (about 2 years ago)
- Last Synced: 2025-04-05T22:43:22.081Z (about 1 year ago)
- Language: JavaScript
- Size: 307 KB
- Stars: 0
- Watchers: 14
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# @stoplight/ordered-object-literal
## Install
Do not use it if you can use maps.
```sh
yarn add @stoplight/ordered-object-literal
```
or if npm is package manager of your choice
```sh
npm install @stoplight/ordered-object-literal --save
```
## Usage
### I want to create a new object
```js
import box from '@stoplight/ordered-object-literal';
const trackedObj = box({});
```
### I have an existing object
```js
import box from '@stoplight/ordered-object-literal';
const myObj = {
a: true,
b: void 0,
};
const trackedObj = box(myObj);
// alternatively if you want to provide a custom orer
const trackedReversedObj = box(myObj, ['b', 'a']);
```
## LICENSE
[Apache License 2.0](https://github.com/stoplightio/ordered-object-literal/blob/master/LICENSE)