-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js.map
1 lines (1 loc) · 39 KB
/
index.js.map
1
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"tslib\"","webpack:///./src/providers/default-provider.ts","webpack:///./src/constants.ts","webpack:///./src/providers/toutiao-provider.ts","webpack:///./src/index.ts","webpack:///./src/i18n.ts","webpack:///./src/config.ts","webpack:///./src/providers/provider-factory.ts","webpack:///./src/providers/alipay-provider.ts","webpack:///./src/store.ts","webpack:///./src/util.ts"],"names":[],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,kC;;;;;;;;;;;ACKA;IAEI,yBAAY,QAAa;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IACM,oCAAU,GAAjB,UAAkB,CAAM;QACpB,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU,EAAE;YACtC,OAAO,UAAC,IAAI,EAAE,QAAQ,IAAK,QAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAzB,CAAyB,CAAC;SACxD;aAAM,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,QAAQ,KAAK,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BAAI,GAAX,UAAY,EAAO;QACf,OAAO,OAAO,EAAE,KAAK,UAAU,CAAC;IACpC,CAAC;IAEM,oBAAK,GAAZ,UAAa,GAAQ;QACjB,OAAO,OAAO,GAAG,KAAK,UAAU,CAAC;IACrC,CAAC;IAEM,oBAAK,GAAZ,UAAa,GAAQ;QACjB,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC;IACnC,CAAC;IACL,WAAC;AAAD,CAAC;AAvCY,oBAAI","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n","module.exports = require(\"tslib\");","import { IProvider } from \"./provider\";\n\n// tslint:disable-next-line\ndeclare var getCurrentPages;\n\nexport class DefaultProvider implements IProvider {\n protected provider: any;\n constructor(provider: any) {\n this.provider = provider;\n }\n public getSetData(p: any): (data: any, callback?: () => void) => void {\n if (p && typeof p.setData === \"function\") {\n return (data, callback) => p.setData(data, callback);\n } else if (p && typeof p.setState === \"function\") {\n return (data, callback) => p.setState(data, callback);\n }\n }\n public request(params: { url: string }) {\n const fn = this.provider && this.provider.request;\n return this.promisify(fn, params);\n }\n public getStorageInfo(): Promise<{ keys: string[]; }> {\n const fn = this.provider && this.provider.getStorageInfo;\n return this.promisify(fn);\n }\n public removeStorage(params: { key: string; }) {\n const fn = this.provider && this.provider.removeStorage;\n return this.promisify(fn, params);\n }\n public setStorage(params: { key: string; data: any; }): Promise<any> {\n const fn = this.provider && this.provider.setStorage;\n return this.promisify(fn, params);\n }\n public getStorage(params: { key: string; }): Promise<{ data: any; }> {\n const fn = this.provider && this.provider.getStorage;\n return this.promisify(fn, params);\n }\n public getStorageSync(key: string): any {\n const fn = this.provider && this.provider.getStorageSync;\n return fn(key);\n }\n public getCurrentPages(): [{ route: string; }] {\n let fn = this.provider && this.provider.getCurrentPages;\n fn = fn || getCurrentPages;\n return fn();\n }\n private promisify(fn, params?: object): Promise<any> {\n if (typeof fn !== \"function\") { throw new TypeError(\"Invalid provider type.\"); }\n params = Object.assign({}, params);\n return new Promise((success, fail) => fn({ ...params, success, fail }))\n .catch((err) => (console.log(err), Promise.reject(err)));\n }\n}\n","export const DESIGN_PARAM_TYPES = \"design:paramtypes\";\nexport const DESIGN_TYPE = \"design:type\";\nexport const DESIGN_RETURN_TYPE = \"design:returntype\";\nexport const I18N_LOAD_LIFETIME = Symbol(\"i18n load lifetime\");\n","import { DefaultProvider } from \"./default-provider\";\nimport { IProvider } from \"./provider\";\n\nexport class TTProvider extends DefaultProvider implements IProvider {\n public getStorageSync(key: string) {\n return super.getStorageSync(key).data;\n }\n}\n","export { i18n, IFormatOptions, II18nLoadOptions, II18nOptions } from \"./i18n\";\nexport { IProvider } from \"./providers/provider\";\nexport { DefaultProvider } from \"./providers/default-provider\";\nexport { I18N_LOAD_LIFETIME } from \"./constants\";\n","import { defaultConfig, II18nConfigOptions } from \"./config\";\nimport { I18nStore } from \"./store\";\nimport { Util } from \"./util\";\n\nexport interface II18nOptions {\n /**\n * The resource(page or component) path, default get current path by 'getCurrentPages'.\n */\n path?: string;\n /**\n * Local texts resource, if not set, it will fetch from the remote.\n */\n texts?: Record<string, any>;\n}\n\nexport interface II18nLoadOptions extends II18nOptions {\n /**\n * Variable name used in the template\n * @default '$t'\n */\n tmplVar?: string;\n /**\n * Current language variable name\n * @default '$lang'\n */\n langVar?: string;\n /**\n * Whether the current target is a component, used to decorate classes.\n * @deprecated\n */\n isComponent?: boolean;\n /**\n * Whether the current target is a page, used to decorate classes.\n * @deprecated\n */\n isPage?: boolean;\n /**\n * The specified lifetime for loading i18n resources, used to decorate classes.\n */\n lifetime?: string;\n}\n\nexport interface IFormatOptions {\n /**\n * The variable matching start symbol\n * @default '{'.\n */\n left?: string;\n /**\n * The variable matching end symbol\n * @default '}'.\n */\n right?: string;\n /**\n * The default value for formatting\n * @default ''.\n */\n defaultValue?: string | object;\n}\nexport let config: II18nConfigOptions;\nlet store: I18nStore;\nlet util: Util;\nlet userLanguage: string;\n\nfunction getLifetime(target: any, options: II18nLoadOptions) {\n options = Object.assign({}, options);\n let lifetime: any = options.lifetime;\n lifetime = lifetime || options.isPage && config.pageLifetime;\n lifetime = lifetime || options.isComponent && config.componentLifetime;\n lifetime = lifetime || config.lifetime;\n lifetime = util.isFn(lifetime) ? lifetime(target.prototype) : lifetime;\n return lifetime;\n}\n\nexport function i18n(options?: II18nLoadOptions): any {\n const decorator = function(target: any, name?: string, descriptor?: PropertyDescriptor) {\n if (typeof target === \"function\") {\n const lifetime = getLifetime(target, options);\n if (!lifetime) { throw new Error(\"unknown lifetime to load i18n resource.\"); }\n const originalValue = target.prototype[lifetime];\n target.prototype[lifetime] = function(...args: any[]) {\n return decorator.fn.call(this).finally(() => originalValue && originalValue.apply(this, args));\n };\n } else {\n const originalValue = descriptor.value;\n descriptor.value = function(...args: any[]) {\n return decorator.fn.call(this).finally(() => originalValue.apply(this, args));\n };\n }\n\n };\n decorator.fn = function() {\n return i18n.load(this, options);\n };\n return decorator;\n}\n\n/**\n * Get current language\n */\ni18n.getLanguage = function(): string {\n const { rememberLanguage, languageStorageKey, provider } = config;\n if (rememberLanguage && languageStorageKey) {\n if (userLanguage) {\n return userLanguage;\n } else {\n const lang = provider.getStorageSync(config.languageStorageKey);\n if (lang) {\n return userLanguage = lang;\n }\n }\n }\n return config.lang;\n};\n/**\n * Set current language\n */\ni18n.setLanguage = function(lang: string) {\n config.lang = lang;\n const { rememberLanguage, languageStorageKey, provider } = config;\n if (rememberLanguage && languageStorageKey) {\n userLanguage = lang;\n provider.setStorage({ key: languageStorageKey, data: lang });\n }\n};\n/**\n * Configure i18n options\n * @param options\n */\ni18n.config = function(options: II18nConfigOptions) {\n config = Object.assign(defaultConfig, options);\n store = new I18nStore(config);\n util = new Util(config);\n util.debug(\"Current i18n config:\", config);\n};\n\n/**\n * Get index resource.\n * @param options options.\n */\ni18n.getIndex = function(options: { forced?: boolean } = {}): Promise<Record<string, any>> {\n const { indexUrl, cachable } = config;\n if (!cachable || options.forced) {\n if (!util.isFn(indexUrl)) { throw new Error(\"Please configure the 'indexUrl' option first.\"); }\n const url = indexUrl();\n if (i18n.getIndex.prototype.promise) { return i18n.getIndex.prototype.promise; }\n util.debug(\"Getting index resource from remote\");\n const clear = () => i18n.getIndex.prototype.promise = undefined;\n const promise = util.request(url)\n .then((data) => store.clear(data))\n .then((data) => (clear(), data), (error) => (clear(), Promise.reject(error)));\n return i18n.getIndex.prototype.promise = promise;\n } else {\n util.debug(\"Trying get index resource from local\");\n return Promise.resolve(i18n.getIndex.prototype.data)\n .then((data) => data || i18n.getIndex({ forced: true }))\n .then((data) => i18n.getIndex.prototype.data = data);\n }\n};\n\n/**\n * Get original i18n resources for the corresponding page or componet (default is current page).\n * @param options options.\n * @returns the original resources.\n *\n * @example\n * i18n.getTexts().then(console.log).catch(console.error);//{ zh:{ hello:\"你好\" },en:{ hello:\"Hello\" } }\n */\ni18n.getTexts = function(options: II18nOptions = {}): Promise<any> {\n const { texts } = options;\n if (texts) {\n util.debug(\"Use local texts\", texts);\n return Promise.resolve(texts);\n }\n const { textsUrl, cachable } = config;\n if (!util.isFn(textsUrl)) { throw new Error(\"Please configure the 'textsUrl' option first.\"); }\n const path = options.path || util.getCurrentPageRoute();\n util.debug(`Current i18n path is ${path}`);\n if (typeof path !== \"string\") { throw new TypeError(\"The path must be string type.\"); }\n return i18n.getIndex()\n .then((resources) => resources[path])\n .then((hash) => {\n if (!hash) {\n return Promise.reject(new Error(`The path '${path}' was not defined in index file.`));\n }\n const url = textsUrl(hash, path);\n if (cachable) {\n return store.get(path).then((data: any) => {\n if (data && data.version === hash) {\n util.debug(`Getting text resource from cache.`);\n return data;\n } else {\n if (!data) {\n util.debug(`The cache resource not exists and getting text resource from remote`);\n } else {\n store.remove(path);\n util.debug(`The cache resource has expired.`);\n }\n return util.request(url)\n .then((res: any) => (res.version = hash, res))\n .then((t: any) => (store.set(path, t), t));\n }\n\n });\n } else {\n util.debug(`Getting text resource from remote`);\n return util.request(url);\n }\n });\n};\n\n/**\n * Load curennt language's resources and bind to the corresponding page or componet (default is current page).\n * @param thisArg page or component object.\n * @param options load options.\n * @returns the i18n resources.\n *\n * @example\n * //index.js\n * const { i18n }=require(\"mp-i18n\");\n * Page({\n * onLoad(){\n * i18n.load(this)\n * }\n * })\n *\n * //index.wxss\n * <view>{{$t.key}}</view>\n */\ni18n.load = function(thisArg: any, options: II18nLoadOptions = {}): Promise<any> {\n const setData = config.provider.getSetData(thisArg);\n if (!util.isFn(setData)) { throw new TypeError(`param 'thisArg' has no method 'setData'.`); }\n const tmplVar = options.tmplVar || config.tmplVar || defaultConfig.tmplVar;\n const langVar = options.langVar || config.langVar || defaultConfig.langVar;\n const getData = (texts) => {\n const data = {};\n const lang = i18n.getLanguage();\n // tslint:disable-next-line\n lang && (data[langVar] = i18n.getLanguage());\n // tslint:disable-next-line\n texts && (data[tmplVar] = texts);\n return data;\n };\n return i18n.getTexts(options)\n .then((t) => i18n.mergeTexts(t))\n .then((texts) => new Promise((resolve) => setData(getData(texts), () => resolve(texts))));\n};\n\n/**\n * Format a template string with the specified parameter.\n * @param template the template string.\n * @param params the parameter object to format template.\n * @param options formatting options, if the matching symbol(left and right) contains\n * special characters, please use the character '\\' to escape, such as { left:\"\\\\${\" }.\n * @returns the formatting result.\n *\n * @example\n * i18n.format('hello, {world}!', { world:'fisher' }) //hello, fisher!\n * i18n.format('hello, {world}!', {},{ defaultValue:'world' }) //hello, world!\n * i18n.format('hello, ${world}!', { world:'fisher' }, { left:\"\\\\${\" }) //hello, fisher!\n */\ni18n.format = function(template: string, params: object, options?: IFormatOptions): string {\n if (!template) { return template; }\n if (!util.isStr(template)) { throw new TypeError(`The param 'template' must be string type.`); }\n options = Object.assign({ left: \"{\", right: \"}\", defaultValue: \"\" }, options);\n const { left, right, defaultValue } = options;\n const regex = new RegExp(`${left}(.+?)${right}`, \"g\");\n const result = template.replace(regex, function(substr: string, key: string) {\n key = key.trim();\n let value = params && params[key];\n if (value === undefined && defaultValue !== undefined) {\n value = typeof defaultValue === \"object\" ? defaultValue[key] : defaultValue;\n }\n return value;\n });\n return result;\n};\n\n/**\n * Merge texts by specified or current language.\n * @param data multi-language texts.\n * @param lang the specified language, default use current language.\n *\n * @example\n * i18n.mergetTexts({ zh:{ hi:'你好' },en:{ hi:'Hi' } },'en') //{ hi:'Hi' }\n */\ni18n.mergeTexts = function(data: any, lang?: string) {\n if (!data) { return {}; }\n const language = lang || i18n.getLanguage();\n if (!(language in data)) {\n util.debug(`The resource corresponding to ${language} does not exist.`, data);\n }\n return data[language];\n};\n","import { I18N_LOAD_LIFETIME } from \"./constants\";\nimport { IProvider } from \"./providers/provider\";\nimport { createProvider } from \"./providers/provider-factory\";\n\nexport interface II18nConfigOptions {\n /**\n * whether to enable cache,\n * @default true.\n */\n cachable?: boolean;\n /**\n * whether to enable debug mode\n * @default false.\n */\n debug?: boolean;\n /**\n * the stroage key for keeping language user selected, it only works when setting 'rememberLanguage' to true.\n * @default 'i18n_language'\n */\n languageStorageKey?: string;\n /**\n * whether to remember the language selected by the user.\n */\n rememberLanguage?: boolean;\n /**\n * the api provider, it is automatically created from the current environment by default.\n */\n provider?: IProvider;\n /**\n * the key prefix for storage\n * @default 'i18n'\n */\n storageKeyPrefix?: string;\n /**\n * initial language\n * if the option 'rememberLanguage' is set to true, the rememberd language is preferred.\n * @default 'zh_CN'\n */\n lang?: string;\n /**\n * texts file path factory function.\n */\n textsUrl: (hash: string, path: string) => string;\n /**\n * index file path factory function.\n */\n indexUrl: () => string;\n /**\n * variable name used in the template\n * @default '$t'.\n */\n tmplVar?: string;\n /**\n * current language variable name\n * @default '$lang'.\n */\n langVar?: string;\n /**\n * the specified lifetime for loading i18n resources\n */\n lifetime?: string | ((prototype: any) => string);\n /**\n * the specified component's lifetime for loading i18n resources,\n * @default attached\n * @deprecated use lifetime instead\n */\n componentLifetime?: string;\n /**\n * the specified page's lifetime for loading i18n resources\n * @default onLoad\n * @deprecated use lifetime instead\n */\n pageLifetime?: string;\n}\n\nexport const defaultConfig = {\n cachable: true,\n componentLifetime: \"attached\",\n debug: false,\n lang: \"zh_CN\",\n langVar: \"$lang\",\n languageStorageKey: \"i18n_language\",\n lifetime: (prototype) => prototype[I18N_LOAD_LIFETIME],\n pageLifetime: \"onLoad\",\n provider: createProvider(),\n rememberLanguage: true,\n storageKeyPrefix: \"i18n\",\n tmplVar: \"$t\",\n};\n","import { AliProvider } from \"./alipay-provider\";\nimport { DefaultProvider } from \"./default-provider\";\nimport { IProvider } from \"./provider\";\nimport { TTProvider } from \"./toutiao-provider\";\n\n// tslint:disable\ndeclare var wx, my, tt, swan;\n\nexport function createProvider(): IProvider {\n try {\n if (wx !== undefined) {\n return new DefaultProvider(wx);\n }\n } catch (error) { }\n try {\n if (my !== undefined) {\n return new AliProvider(my);\n }\n } catch (error) { }\n try {\n if (tt !== undefined) {\n return new TTProvider(tt);\n }\n } catch (error) { }\n try {\n if (swan !== undefined) {\n return new DefaultProvider(tt);\n }\n } catch (error) { }\n}\n","import { IProvider } from \"./provider\";\nimport { TTProvider } from \"./toutiao-provider\";\n\nexport class AliProvider extends TTProvider implements IProvider {\n public request(params: { url: string }): Promise<{ data: any, statusCode: number, header: object }> {\n return super.request(params)\n .then((res) => (res.statusCode = res.status, res));\n }\n}\n","import { II18nConfigOptions } from \"./config\";\nimport { IProvider } from \"./providers/provider\";\n\nexport class I18nStore {\n private provider: IProvider;\n private prefix: string;\n private languageKey: string;\n constructor(config: II18nConfigOptions) {\n this.prefix = config.storageKeyPrefix;\n this.provider = config.provider;\n this.languageKey = config.languageStorageKey;\n }\n public get(path: string) {\n const key = this.getKey(path);\n return this.provider.getStorage({ key })\n .then((res) => res.data)\n .catch(() => null);\n }\n public set(path: string, data: any) {\n const key = this.getKey(path);\n return this.provider.setStorage({ key, data });\n }\n public has(path: string): Promise<boolean> {\n const key = this.getKey(path);\n return this.provider.getStorageInfo()\n .then((res) => res.keys.indexOf(key) >= 0)\n .catch(() => false);\n }\n public remove(path: string) {\n const key = this.getKey(path);\n return this.provider.removeStorage({ key });\n }\n public getAll() {\n if (!this.prefix) {\n return Promise.reject(new Error(\"missing i18n configuration option 'storageKeyPrefix'\"));\n }\n return this.provider.getStorageInfo()\n .then((info) => info.keys)\n .then((keys) => keys.filter((key: string) => key.startsWith(this.prefix)));\n }\n public clear(data: object) {\n const from = this.getKey(\"\").length;\n this.getAll()\n .then((keys) => keys.filter((key) => key !== this.languageKey && !(key.substr(from) in data)))\n .then((keys) => keys.forEach((key) => this.provider.removeStorage({ key })))\n .catch(console.error);\n return data;\n }\n private getKey(path: string) {\n return `${this.prefix}/${path}`;\n }\n}\n","import { II18nConfigOptions } from \"./config\";\n\nexport class Util {\n constructor(private config: II18nConfigOptions) { }\n public getCurrentPageRoute() {\n const pages = this.config.provider.getCurrentPages();\n const currentPage = pages[pages.length - 1];\n return currentPage.route || currentPage.__route__;\n }\n\n public request(url: string) {\n this.debug(`i18n request url: ${url}`);\n return this.config.provider.request({ url })\n .then((res: any) => (res.statusCode = res.statusCode || res.status, res))\n .then(({ statusCode, data }) => (statusCode === 200 ? data : Promise.reject(new Error(`Incorrent status code ${statusCode}`))))\n .then((data: any) => {\n if (typeof data === \"object\") {\n return data;\n }\n return Promise.reject(new Error(\"invalid i18n config file, please check file contents.\"));\n })\n .catch((error) => (this.debug(\"request error:\", error), Promise.reject(error)));\n }\n\n public debug(...args: any[]) {\n if (this.config.debug) {\n console.log(...args);\n }\n }\n\n public isFn(fn: any) {\n return typeof fn === \"function\";\n }\n\n public isObj(obj: any) {\n return typeof obj === \"function\";\n }\n\n public isStr(str: any) {\n return typeof str === \"string\";\n }\n}\n"],"sourceRoot":""}