Skip to content

Transforming ops with different use of integer/string indexes doesn't work #37

Description

@alecgibson

Given an object obj and an array arr, in JavaScript, these statements are true:

arr['123'] === arr[123]
obj['123'] === obj[123]

Therefore, these paths should be equivalent:

var p1 = ['foo', '1']
var p2 = ['foo', 1]

However, json0 doesn't treat them as such. For example, this transformation fails:

const op1 = [{p: ['a', '1', 0], si: 'hi'}]
const op2 = [{p: ['a', 1], lm: 0}]

json0.transform(op1, op2, 'left')

Actual result: [{p: ["a", 2, 0], si: "hi"}]
Expected result: [{p: ["a", 0, 0], si: "hi"}]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions