find.js 545 B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.$$find = void 0;
  4. const $$find = (path) => {
  5. if (path.length === 0)
  6. return '(function(x){return x})';
  7. let fn = '(function(){var h=Object.prototype.hasOwnProperty;return(function(o){var k,u=void 0;try{';
  8. for (let i = 0; i < path.length; i++) {
  9. fn += 'k=' + JSON.stringify(path[i]) + ';';
  10. fn += 'if(!h.call(o,k))return u;o=o[k];';
  11. }
  12. fn += 'return o}catch(e){return u}})})()';
  13. return fn;
  14. };
  15. exports.$$find = $$find;