_castPath.js 369 B

123456789101112131415
  1. var isArray = require('./isArray'),
  2. stringToPath = require('./_stringToPath');
  3. /**
  4. * Casts `value` to a path array if it's not one.
  5. *
  6. * @private
  7. * @param {*} value The value to inspect.
  8. * @returns {Array} Returns the cast property path array.
  9. */
  10. function castPath(value) {
  11. return isArray(value) ? value : stringToPath(value);
  12. }
  13. module.exports = castPath;