Skip to content

Encoding issue with object's key starting with a digit #24

@panthony

Description

@panthony

Maybe related to #5 .

The library fails to encode properly objects with keys starting with a digit:

{
  "2xx": 10,
  "3xx": 42
}

Expected is ('2xx':10,'3xx':42), actual is (!n:10,!n:42).

To reproduce:

    it('Should handle string starting with digit as object keys', function() {
        var object = { '2xx': 10, '3xx': 42 };

        var encoded = rison.encode(object);

        expect(encoded).to.equal(`('2xx':10,'3xx':42)`);

        var serializedObject = `('2xx':10,'3xx':42)`;

        var deserializedObject = rison.decode(serializedObject);

        expect(deserializedObject).to.deep.equal(object);
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions