updeep-remeda/dist/is.js

16 lines
462 B
JavaScript
Raw Normal View History

2023-01-03 18:51:35 +00:00
import splitPath from "./util/splitPath.js";
import wrap from "./wrap.js";
function _is(object, path, predicate) {
const parts = splitPath(path);
for (const part of parts) {
if (typeof object === "undefined")
return false;
object = object[part];
}
if (typeof predicate === "function") {
return predicate(object);
}
return predicate === object;
}
export default wrap(_is);
//# sourceMappingURL=is.js.map