Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_castPath.js 569B

123456789101112131415161718192021
  1. var isArray = require('./isArray'),
  2. isKey = require('./_isKey'),
  3. stringToPath = require('./_stringToPath'),
  4. toString = require('./toString');
  5. /**
  6. * Casts `value` to a path array if it's not one.
  7. *
  8. * @private
  9. * @param {*} value The value to inspect.
  10. * @param {Object} [object] The object to query keys on.
  11. * @returns {Array} Returns the cast property path array.
  12. */
  13. function castPath(value, object) {
  14. if (isArray(value)) {
  15. return value;
  16. }
  17. return isKey(value, object) ? [value] : stringToPath(toString(value));
  18. }
  19. module.exports = castPath;