main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
567 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import isArray from './isArray.js';
|
---|
| 2 | import isKey from './_isKey.js';
|
---|
| 3 | import stringToPath from './_stringToPath.js';
|
---|
| 4 | import toString from './toString.js';
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * Casts `value` to a path array if it's not one.
|
---|
| 8 | *
|
---|
| 9 | * @private
|
---|
| 10 | * @param {*} value The value to inspect.
|
---|
| 11 | * @param {Object} [object] The object to query keys on.
|
---|
| 12 | * @returns {Array} Returns the cast property path array.
|
---|
| 13 | */
|
---|
| 14 | function castPath(value, object) {
|
---|
| 15 | if (isArray(value)) {
|
---|
| 16 | return value;
|
---|
| 17 | }
|
---|
| 18 | return isKey(value, object) ? [value] : stringToPath(toString(value));
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | export default castPath;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.