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AC;AAExG;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,GAAQ;IACnC,IAAI,eAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE;QAC9B,IAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAC3B,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACvB,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAG,CAAC,gBAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,SAAG,CAAC,kBAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;KACpF;IACD,OAAO,kBAAU,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAPD,oCAOC;AAED;;;;GAIG;AACU,QAAA,SAAS,GAAkC,SAAG,CAAC,gBAAQ,EAAE,UAAI,CAAC,UAAI,CAAC,MAAM,CAAC,EAAE,kBAAU,CAAC,CAAC,CAAC",
10 "sourcesContent": [
11 "/**\n * Predicates\n *\n * These predicates return true/false based on the input.\n * Although these functions are exported, they are subject to change without notice.\n *\n * @packageDocumentation\n */\nimport { and, not, pipe, prop, or } from './hof';\nimport { Predicate } from './common'; // has or is using\nimport { StateObject } from '../state/stateObject';\n\nconst toStr = Object.prototype.toString;\nconst tis = (t: string) => (x: any) => typeof x === t;\nexport const isUndefined = tis('undefined');\nexport const isDefined = not(isUndefined);\nexport const isNull = (o: any) => o === null;\nexport const isNullOrUndefined = or(isNull, isUndefined);\nexport const isFunction: (x: any) => x is Function = <any>tis('function');\nexport const isNumber: (x: any) => x is number = <any>tis('number');\nexport const isString = <(x: any) => x is string>tis('string');\nexport const isObject = (x: any) => x !== null && typeof x === 'object';\nexport const isArray = Array.isArray;\nexport const isDate: (x: any) => x is Date = <any>((x: any) => toStr.call(x) === '[object Date]');\nexport const isRegExp: (x: any) => x is RegExp = <any>((x: any) => toStr.call(x) === '[object RegExp]');\n\n/**\n * Predicate which checks if a value is injectable\n *\n * A value is \"injectable\" if it is a function, or if it is an ng1 array-notation-style array\n * where all the elements in the array are Strings, except the last one, which is a Function\n */\nexport function isInjectable(val: any) {\n if (isArray(val) && val.length) {\n const head = val.slice(0, -1),\n tail = val.slice(-1);\n return !(head.filter(not(isString)).length || tail.filter(not(isFunction)).length);\n }\n return isFunction(val);\n}\n\n/**\n * Predicate which checks if a value looks like a Promise\n *\n * It is probably a Promise if it's an object, and it has a `then` property which is a Function\n */\nexport const isPromise = <(x: any) => x is Promise<any>>and(isObject, pipe(prop('then'), isFunction));\n"
12 ]
13}
\No newline at end of file