mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Ensure _.toPath returns a new array.
This commit is contained in:
@@ -14526,7 +14526,7 @@
|
||||
if (isArray(value)) {
|
||||
return arrayMap(value, baseCastKey);
|
||||
}
|
||||
return isSymbol(value) ? [value] : stringToPath(value);
|
||||
return isSymbol(value) ? [value] : copyArray(stringToPath(value));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22108,6 +22108,12 @@
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('should a new path array', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.notStrictEqual(_.toPath('a.b.c'), _.toPath('a.b.c'));
|
||||
});
|
||||
|
||||
QUnit.test('should not coerce symbols to strings', function(assert) {
|
||||
assert.expect(4);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user