1 |
- {"ast":null,"code":"\"use strict\";\n\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.PropertyCollection = void 0;\nconst Exports_js_1 = require(\"./Exports.js\");\n/**\n * Represents collection of properties and their values.\n * @class PropertyCollection\n */\nclass PropertyCollection {\n constructor() {\n this.privKeys = [];\n this.privValues = [];\n }\n /**\n * Returns the property value in type String.\n * Currently only String, int and bool are allowed.\n * If the name is not available, the specified defaultValue is returned.\n * @member PropertyCollection.prototype.getProperty\n * @function\n * @public\n * @param {string} key - The parameter name.\n * @param {string | number | boolean} def - The default value which is returned if the parameter\n * is not available in the collection.\n * @returns {string} value of the parameter.\n */\n getProperty(key, def) {\n let keyToUse;\n if (typeof key === \"string\") {\n keyToUse = key;\n } else {\n keyToUse = Exports_js_1.PropertyId[key];\n }\n for (let n = 0; n < this.privKeys.length; n++) {\n if (this.privKeys[n] === keyToUse) {\n return this.privValues[n];\n }\n }\n if (def === undefined) {\n return undefined;\n }\n return String(def);\n }\n /**\n * Sets the String value of the parameter specified by name.\n * @member PropertyCollection.prototype.setProperty\n * @function\n * @public\n * @param {string} key - The parameter name.\n * @param {string} value - The value of the parameter.\n */\n setProperty(key, value) {\n let keyToUse;\n if (typeof key === \"string\") {\n keyToUse = key;\n } else {\n keyToUse = Exports_js_1.PropertyId[key];\n }\n for (let n = 0; n < this.privKeys.length; n++) {\n if (this.privKeys[n] === keyToUse) {\n this.privValues[n] = value;\n return;\n }\n }\n this.privKeys.push(keyToUse);\n this.privValues.push(value);\n }\n /**\n * Clones the collection.\n * @member PropertyCollection.prototype.clone\n * @function\n * @public\n * @returns {PropertyCollection} A copy of the collection.\n */\n clone() {\n const clonedMap = new PropertyCollection();\n for (let n = 0; n < this.privKeys.length; n++) {\n clonedMap.privKeys.push(this.privKeys[n]);\n clonedMap.privValues.push(this.privValues[n]);\n }\n return clonedMap;\n }\n /**\n * Merges this set of properties into another, no overwrites.\n * @member PropertyCollection.prototype.mergeTo\n * @function\n * @public\n * @param {PropertyCollection} destinationCollection - The collection to merge into.\n */\n mergeTo(destinationCollection) {\n this.privKeys.forEach(key => {\n if (destinationCollection.getProperty(key, undefined) === undefined) {\n const value = this.getProperty(key);\n destinationCollection.setProperty(key, value);\n }\n });\n }\n /**\n * Get the keys in Property Collection.\n * @member PropertyCollection.prototype.keys\n * @function\n * @public\n * @returns {string []} Keys in the collection.\n */\n get keys() {\n return this.privKeys;\n }\n}\nexports.PropertyCollection = PropertyCollection;","map":{"version":3,"names":["Object","defineProperty","exports","value","PropertyCollection","Exports_js_1","require","constructor","privKeys","privValues","getProperty","key","def","keyToUse","PropertyId","n","length","undefined","String","setProperty","push","clone","clonedMap","mergeTo","destinationCollection","forEach","keys"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/PropertyCollection.js"],"sourcesContent":["\"use strict\";\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PropertyCollection = void 0;\nconst Exports_js_1 = require(\"./Exports.js\");\n/**\n * Represents collection of properties and their values.\n * @class PropertyCollection\n */\nclass PropertyCollection {\n constructor() {\n this.privKeys = [];\n this.privValues = [];\n }\n /**\n * Returns the property value in type String.\n * Currently only String, int and bool are allowed.\n * If the name is not available, the specified defaultValue is returned.\n * @member PropertyCollection.prototype.getProperty\n * @function\n * @public\n * @param {string} key - The parameter name.\n * @param {string | number | boolean} def - The default value which is returned if the parameter\n * is not available in the collection.\n * @returns {string} value of the parameter.\n */\n getProperty(key, def) {\n let keyToUse;\n if (typeof key === \"string\") {\n keyToUse = key;\n }\n else {\n keyToUse = Exports_js_1.PropertyId[key];\n }\n for (let n = 0; n < this.privKeys.length; n++) {\n if (this.privKeys[n] === keyToUse) {\n return this.privValues[n];\n }\n }\n if (def === undefined) {\n return undefined;\n }\n return String(def);\n }\n /**\n * Sets the String value of the parameter specified by name.\n * @member PropertyCollection.prototype.setProperty\n * @function\n * @public\n * @param {string} key - The parameter name.\n * @param {string} value - The value of the parameter.\n */\n setProperty(key, value) {\n let keyToUse;\n if (typeof key === \"string\") {\n keyToUse = key;\n }\n else {\n keyToUse = Exports_js_1.PropertyId[key];\n }\n for (let n = 0; n < this.privKeys.length; n++) {\n if (this.privKeys[n] === keyToUse) {\n this.privValues[n] = value;\n return;\n }\n }\n this.privKeys.push(keyToUse);\n this.privValues.push(value);\n }\n /**\n * Clones the collection.\n * @member PropertyCollection.prototype.clone\n * @function\n * @public\n * @returns {PropertyCollection} A copy of the collection.\n */\n clone() {\n const clonedMap = new PropertyCollection();\n for (let n = 0; n < this.privKeys.length; n++) {\n clonedMap.privKeys.push(this.privKeys[n]);\n clonedMap.privValues.push(this.privValues[n]);\n }\n return clonedMap;\n }\n /**\n * Merges this set of properties into another, no overwrites.\n * @member PropertyCollection.prototype.mergeTo\n * @function\n * @public\n * @param {PropertyCollection} destinationCollection - The collection to merge into.\n */\n mergeTo(destinationCollection) {\n this.privKeys.forEach((key) => {\n if (destinationCollection.getProperty(key, undefined) === undefined) {\n const value = this.getProperty(key);\n destinationCollection.setProperty(key, value);\n }\n });\n }\n /**\n * Get the keys in Property Collection.\n * @member PropertyCollection.prototype.keys\n * @function\n * @public\n * @returns {string []} Keys in the collection.\n */\n get keys() {\n return this.privKeys;\n }\n}\nexports.PropertyCollection = PropertyCollection;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACAA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,kBAAkB,GAAG,KAAK,CAAC;AACnC,MAAMC,YAAY,GAAGC,OAAO,CAAC,cAAc,CAAC;AAC5C;AACA;AACA;AACA;AACA,MAAMF,kBAAkB,CAAC;EACrBG,WAAWA,CAAA,EAAG;IACV,IAAI,CAACC,QAAQ,GAA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