blob: 333d91a2f8a727ca8c669e9610eec0eea0510f18 [file] [log] [blame]
{"version":3,"file":"coercion.es5.js","sources":["../../../src/cdk/coercion/element.ts","../../../src/cdk/coercion/css-pixel-value.ts","../../../src/cdk/coercion/array.ts","../../../src/cdk/coercion/number-property.ts","../../../src/cdk/coercion/boolean-property.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ElementRef} from '@angular/core';\n\n/**\n * Coerces an ElementRef or an Element into an element.\n * Useful for APIs that can accept either a ref or the native element itself.\n */\nexport function coerceElement<T>(elementOrRef: ElementRef<T> | T): T {\n return elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Coerces a value to a CSS pixel value. */\nexport function coerceCssPixelValue(value: any): string {\n if (value == null) {\n return '';\n }\n\n return typeof value === 'string' ? value : `${value}px`;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Wraps the provided value in an array, unless the provided value is an array. */\nexport function coerceArray<T>(value: T | T[]): T[] {\n return Array.isArray(value) ? value : [value];\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Coerces a data-bound value (typically a string) to a number. */\nexport function coerceNumberProperty(value: any): number;\nexport function coerceNumberProperty<D>(value: any, fallback: D): number | D;\nexport function coerceNumberProperty(value: any, fallbackValue = 0) {\n return _isNumberValue(value) ? Number(value) : fallbackValue;\n}\n\n/**\n * Whether the provided value is considered a number.\n * @docs-private\n */\nexport function _isNumberValue(value: any): boolean {\n // parseFloat(value) handles most of the cases we're interested in (it treats null, empty string,\n // and other non-number values as NaN, where Number just uses 0) but it considers the string\n // '123hello' to be a valid number. Therefore we also check if Number(value) is NaN.\n return !isNaN(parseFloat(value as any)) && !isNaN(Number(value));\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Coerces a data-bound value (typically a string) to a boolean. */\nexport function coerceBooleanProperty(value: any): boolean {\n return value != null && `${value}` !== 'false';\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AISA,AAAA,SAAgB,qBAAqB,CAAC,KAAU,EAAhD;IACE,OAAO,KAAK,IAAI,IAAI,IAAI,EAA1B,GAA6B,KAAO,KAAK,OAAO,CAAC;CAChD;;;;;;;;;;;;ADAD,AAAA,SAAgB,oBAAoB,CAAC,KAAU,EAAE,aAAiB,EAAlE;IAAiD,IAAjD,aAAA,KAAA,KAAA,CAAA,EAAiD,EAAA,aAAjD,GAAA,CAAkE,CAAlE,EAAA;IACE,OAAO,cAAc,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC;CAC9D;;;;;;;AAMD,AAAA,SAAgB,cAAc,CAAC,KAAU,EAAzC;;;;IAIE,OAAO,CAAC,KAAK,CAAC,UAAU,oBAAC,KAAK,GAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CAClE;;;;;;;;;;;;;ADfD,AAAA,SAAgB,WAAW,CAAI,KAAc,EAA7C;IACE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;CAC/C;;;;;;;;;;;;ADFD,AAAA,SAAgB,mBAAmB,CAAC,KAAU,EAA9C;IACE,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,GAAM,KAAK,GAArD,IAAyD,CAAC;CACzD;;;;;;;;;;;;;ADDD,AAAA,SAAgB,aAAa,CAAI,YAA+B,EAAhE;IACE,OAAO,YAAY,YAAY,UAAU,GAAG,YAAY,CAAC,aAAa,GAAG,YAAY,CAAC;CACvF;;;;;;;;;;;;;;"}