minter-js-sdk
Version:
JS SDK for Minter Blockchain
24 lines (20 loc) • 600 B
JavaScript
;
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;