adopted-ember-addons / adopted-ember-addons/validated-changeset

Cannot get property in an array of objects

オープン
#178 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
38
フォーク
27
PR マージ指標
30日以内にマージされた PR はありません

説明

Hello,

I'm trying to get a property in an array of objects. It seems that the changes are not retrieved properly with `.get()`. Sadly, I don't know enough about this library to identify the problem.

Also, i didn't see examples of changeset with an array of objects in the documentation. Is it recommended ?

I made a simple reproduction test that explains the problem.

```js
describe('arrays of objects', () => {
test('changes in array are gettable', () => {
let initialData = { contacts: [] };

const changeset = Changeset(initialData);

changeset.set("contacts", [{
name :'william'
}]);

// returns undefined
expect(changeset.get("contacts.0")).toStrictEqual({
name :'william'
});
expect(changeset.get("contacts.0.name")).toStrictEqual(
'william'
);
});
});
```

node version : 14.19.1
validated-changeset: 1.3.3

Thank you in advance.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。