1
0
mirror of https://github.com/dzeiocom/libs.git synced 2025-07-25 14:29:51 +00:00

fix: when path is empty it should return the current object

Signed-off-by: Avior <git@avior.me>
This commit is contained in:
2024-06-10 23:36:53 +02:00
parent 8fc6f39b40
commit fe2e5a3bdc
2 changed files with 7 additions and 8 deletions

View File

@ -511,11 +511,9 @@ describe('object get', () => {
})
it('object get should return undefined', () => {
expect(() => {
objectGet({a: { b: [{ c: 'pouet' }]}}, [])
}).toThrow()
expect(() => {
objectGet({a: { b: [{ c: 'pouet' }]}}, '')
}).toThrow()
expect(objectGet({a: 'pouet'}, []))
.toEqual({a: 'pouet'})
expect(objectGet({a: 'pouet'}, ''))
.toEqual({a: 'pouet'})
})
})