Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read properties of undefined (reading 'filter') thrown on arrays in nested objects #2

Open
jfloodnet opened this issue Jul 9, 2023 · 0 comments · May be fixed by #4
Open

Cannot read properties of undefined (reading 'filter') thrown on arrays in nested objects #2

jfloodnet opened this issue Jul 9, 2023 · 0 comments · May be fixed by #4

Comments

@jfloodnet
Copy link

jfloodnet commented Jul 9, 2023

test("deeply nested array", () => {
	assert.equal(
		patch(
			{
				test: true,
				bananas: {
					stock: {
						geneva: true,
						stockholm: false,
						items: ["one", "two", "three"]
					},
				},
			},
			[{ path: ["bananas", "stock", "items", 1], type: "REMOVE" }]
		),
		{
			test: true,
			bananas: {
				stock: {
					geneva: true,
				},
			},
		}
	);
});

Test fails with:

` FAIL "deeply nested array"
Cannot read properties of undefined (reading 'filter')

at file:///C:/dev/micropatch/dist/index.js:25:10
at file:///C:/dev/micropatch/dist/index.js:36:43
at Array.forEach (<anonymous>)
at patch (file:///C:/dev/micropatch/dist/index.js:36:16)
at Object.handler (file:///C:/dev/micropatch/tests/basic.js:60:3)
at Number.runner (file:///C:/dev/micropatch/node_modules/uvu/dist/index.mjs:78:16)
at async Module.exec (file:///C:/dev/micropatch/node_modules/uvu/dist/index.mjs:141:33)
at async Module.run (file:///C:/dev/micropatch/node_modules/uvu/run/index.mjs:12:2)
at async C:/dev/micropatch/node_modules/uvu/bin.js:26:5`
@FluentCoding FluentCoding linked a pull request Mar 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant