sindresorhus / dot-prop

Get, set, or delete a property from a nested object using a dot path

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deepKeys doesn't work with sparsed arrays: ".for is not iterable"

AuthorProxy opened this issue · comments

deepKeys doesn't work with sparsed arrays

it("deepKeys should not cause an error with sparsed arrays", () => {
  // fixture setup
  const mockedEntity = {
    // eslint-disable-next-line no-sparse-arrays
    open_hours: [1, , 3],
  };

  const sut = () => {
    deepKeys(mockedEntity);
  };

  // exercise system
  // verify outcome
  expect(sut).not.toThrow();
});

Error name: "TypeError"
Error message: ".for is not iterable"

@sindresorhus you fixed it but it doesn't work correctly, check #110