This repository was archived by the owner on Aug 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Modify
Cedric Poon edited this page Jan 21, 2020
·
2 revisions
Modify is a mutable class to modify given JSON Object according to its object methods. This class is used in Rjson.modify()
Each object methods will return same (i.e. this) instance of Modify Object.
Each instantiation should be carried out using ordinary function call.
| Parameter | Type | Description | Default | Required |
|---|---|---|---|---|
sourceObj |
Object |
Object to be modified | — | Yes |
Raw underlying object.
| Accessibility | |
|---|---|
| Getter | Yes |
| Setter | No |
Append object o at the end of all keys with its children keypairs.
| Parameter | Type | Description | Default | Required |
|---|---|---|---|---|
o |
Object |
Object to be appended | — | Yes |
| Return | Type | Description |
|---|---|---|
| * | Modify |
Mutable self reference (i.e. this) |
const { Rjson } = require('reyaml-core');
const rj = new Rjson({ foo: 'bar' });
rj.modify(m => m
.append({ reyaml: 'core' })
);
// or
rj.modify(m => { return m
.append({ reyaml: 'core' })
});Prepend object o at the beginning of all keys with its children keypairs.
| Parameter | Type | Description | Default | Required |
|---|---|---|---|---|
o |
Object |
Object to be prepended | — | Yes |
| Return | Type | Description |
|---|---|---|
| * | Modify |
Mutable self reference (i.e. this) |
const { Rjson } = require('reyaml-core');
const rj = new Rjson({ foo: 'bar' });
rj.modify(m => m
.prepend({ reyaml: 'core' })
);
// or
rj.modify(m => { return m
.prepend({ reyaml: 'core' })
});REyaml-Core Wiki page is released under the same license as repository itself.