speech_rules.js 838 B

1234567891011121314151617181920
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.addStore = addStore;
  4. exports.getStore = getStore;
  5. const dynamic_cstr_js_1 = require("../rule_engine/dynamic_cstr.js");
  6. const funcStore = new Map();
  7. function addStore(constr, inherit, store) {
  8. const values = {};
  9. if (inherit) {
  10. const inherits = funcStore.get(inherit) || {};
  11. Object.assign(values, inherits);
  12. }
  13. funcStore.set(constr, Object.assign(values, store));
  14. }
  15. function getStore(locale, modality, domain) {
  16. return (funcStore.get([locale, modality, domain].join('.')) ||
  17. funcStore.get([dynamic_cstr_js_1.DynamicCstr.DEFAULT_VALUES[dynamic_cstr_js_1.Axis.LOCALE], modality, domain].join('.')) ||
  18. funcStore.get([dynamic_cstr_js_1.DynamicCstr.BASE_LOCALE, modality, domain].join('.')) ||
  19. {});
  20. }