We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
let patch:jiff.JSONPatch = [{ 'op': 'add', 'path': '/test/321/prop1', 'value': new String('value'), 'context': { id : '321' } }] let doc = {test: [{ id: '321', prop1: 'old_value' }]} let result = jiff.patch(patch, doc, { findContext: (index, array, context) => { return array.findIndex((value, index, array) => value["id"] === context.id); } })
which results in
{ "test":[{ "id":"321", "prop1":{ "0":"v", "1":"a", "2":"l", "3":"u", "4":"e" } }] }"
ideally the clone logic would have a special case for String objects if possible resulting in
{ "test":[{ "id":"321", "prop1":"value" }] }
something like the following in clone could work
function clone(x) { if(x == null || typeof x !== 'object' || x instanceof String || x instanceof Number) { return x; } if(Array.isArray(x)) { return cloneArray(x); } return cloneObject(x); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
which results in
ideally the clone logic would have a special case for String objects if possible resulting in
something like the following in clone could work
The text was updated successfully, but these errors were encountered: