@euirim/microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 3.25 kB
Source Map (JSON)
{"version":3,"sources":["src/sdk/PropertyCollection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;GAGG;AACH,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,UAAU,CAA4B;IAE9C;;;;;;;;;;;OAWG;IACI,WAAW,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM;IAkBlE;;;;;;;OAOG;IACI,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAoBjE;;;;;;OAMG;IACI,KAAK,IAAI,kBAAkB;CAUrC","file":"PropertyCollection.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\nimport { PropertyId } from \"./Exports\";\n\n/**\n * Represents collection of properties and their values.\n * @class PropertyCollection\n */\nexport class PropertyCollection {\n private privKeys: string[] = [] as string[];\n private privValues: string[] = [] as string[];\n\n /**\n * Returns the property value in type String. The parameter must have the same type as 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} 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 public getProperty(key: PropertyId | string, def?: string): string {\n let keyToUse: string;\n\n if (typeof key === \"string\") {\n keyToUse = key;\n } else {\n keyToUse = PropertyId[key];\n }\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\n return def;\n }\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 public setProperty(key: string | PropertyId, value: string): void {\n let keyToUse: string;\n\n if (typeof key === \"string\") {\n keyToUse = key;\n } else {\n keyToUse = PropertyId[key];\n }\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\n this.privKeys.push(keyToUse);\n this.privValues.push(value);\n }\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 public clone(): PropertyCollection {\n const clonedMap = new PropertyCollection();\n\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\n return clonedMap;\n }\n}\n"]}