mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Flatten at paths parameter (#4431)
* Enable at tests * Flatten at paths parameter
This commit is contained in:
committed by
John-David Dalton
parent
1011cfdf4c
commit
e5f840745b
3
at.js
3
at.js
@@ -1,4 +1,5 @@
|
||||
import baseAt from './.internal/baseAt.js'
|
||||
import baseFlatten from './.internal/baseFlatten.js'
|
||||
|
||||
/**
|
||||
* Creates an array of values corresponding to `paths` of `object`.
|
||||
@@ -15,6 +16,6 @@ import baseAt from './.internal/baseAt.js'
|
||||
* at(object, ['a[0].b.c', 'a[1]'])
|
||||
* // => [3, 4]
|
||||
*/
|
||||
const at = (...paths) => baseAt(paths)
|
||||
const at = (object, ...paths) => baseAt(object, baseFlatten(paths, 1))
|
||||
|
||||
export default at
|
||||
|
||||
@@ -43,7 +43,7 @@ describe('at', function() {
|
||||
});
|
||||
|
||||
it('should work with a falsey `object` when keys are given', function() {
|
||||
var expected = lodashStable.map(falsey, lodashStable.constant(Array(4)));
|
||||
var expected = lodashStable.map(falsey, lodashStable.constant(Array(4).fill(undefined)));
|
||||
|
||||
var actual = lodashStable.map(falsey, function(object) {
|
||||
try {
|
||||
Reference in New Issue
Block a user