Skip to content

[BUG] makeImmutable skips over recursively marking values as immutable if a single property name is provided #809

@jdmarshall

Description

@jdmarshall

Describe the bug

@param [value] {* | [*]} - Property value (or array of values) to set
       the property to before making immutable. Only used when setting a single
       property. Retained for backward compatibility.

This description is inaccurate, and the functionality should be removed or fixed.

Submitting a PR for a failing test for the test suite is ideal.

Expected behavior

        let obj = {item1: 23};
        Config.util.makeImmutable(obj, "item1", [{value: 25}]); //TODO: no recursion on string properties
        assert.isArray(obj.item1);
        obj.item1[0].value = 55;
        assert.equal(obj.item1, 25); // fails due to lack of recursion if the 2nd argument is a string

Screenshots
If applicable, add screenshots to help explain your problem.

Please tell us about your environment:

  • node-config version: x.x.x
  • node-version: x.x.x

Other information

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