rtfeldman / seamless-immutable

Immutable data structures for JavaScript which are backwards-compatible with normal JS Arrays and Objects.
BSD 3-Clause "New" or "Revised" License
5.36k stars 194 forks source link

`{deep: true}` does not work as expected with arrays #210

Open pladaria opened 7 years ago

pladaria commented 7 years ago

Maybe I'm misunderstanding the API but I would expect merge to work with arrays as it does with objects

test case in RunKit

const Immutable = require("seamless-immutable");

const data = {a: 1, b: 2, c: 3};
const nums = [1, 2, 3];

const imm1 = Immutable({key: data});
const imm2 = Immutable({key: nums});

console.log(imm1 === imm1.set('key', data, {deep: true})); // true
console.log(imm2 === imm2.set('key', nums, {deep: true})); // false