optional-chaining.js 474 B

1234567891011121314151617
  1. "use strict";
  2. module.exports = function (t, a) {
  3. var obj = { foo: { bar: "elo", par: null } };
  4. a(t(), undefined);
  5. a(t(null), null);
  6. a(t(obj), obj);
  7. a(t(obj, "foo"), obj.foo);
  8. a(t(obj, "foo", "bar"), "elo");
  9. a(t(obj, "foo", "bar", "slice"), String.prototype.slice);
  10. a(t(obj, "foo", "par"), null);
  11. a(t(obj, "foo", "par", "marko"), undefined);
  12. a(t(obj, "marko"), undefined);
  13. a(t(""), "");
  14. a(t("", "foo"), undefined);
  15. a(t("", "slice"), String.prototype.slice);
  16. };