UNPKG

minter-js-sdk

Version:
24 lines (20 loc) 600 B
'use strict'; var isArray = require('./isArray.js'); var _isKey = require('./_isKey.js'); var _stringToPath = require('./_stringToPath.js'); var toString = require('./toString.js'); /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @param {Object} [object] The object to query keys on. * @returns {Array} Returns the cast property path array. */ function castPath(value, object) { if (isArray(value)) { return value; } return _isKey(value, object) ? [value] : _stringToPath(toString(value)); } module.exports = castPath;