1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { ɵglobal as global } from '@angular/core';
|
---|
9 | const CAMEL_CASE_REGEXP = /([A-Z])/g;
|
---|
10 | const DASH_CASE_REGEXP = /-([a-z])/g;
|
---|
11 | export function camelCaseToDashCase(input) {
|
---|
12 | return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
|
---|
13 | }
|
---|
14 | export function dashCaseToCamelCase(input) {
|
---|
15 | return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
|
---|
16 | }
|
---|
17 | /**
|
---|
18 | * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
|
---|
19 | * `name` is `'probe'`.
|
---|
20 | * @param name Name under which it will be exported. Keep in mind this will be a property of the
|
---|
21 | * global `ng` object.
|
---|
22 | * @param value The value to export.
|
---|
23 | */
|
---|
24 | export function exportNgVar(name, value) {
|
---|
25 | if (typeof COMPILED === 'undefined' || !COMPILED) {
|
---|
26 | // Note: we can't export `ng` when using closure enhanced optimization as:
|
---|
27 | // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
|
---|
28 | // - we can't declare a closure extern as the namespace `ng` is already used within Google
|
---|
29 | // for typings for angularJS (via `goog.provide('ng....')`).
|
---|
30 | const ng = global['ng'] = global['ng'] || {};
|
---|
31 | ng[name] = value;
|
---|
32 | }
|
---|
33 | }
|
---|
34 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3BsYXRmb3JtLWJyb3dzZXIvc3JjL2RvbS91dGlsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3Mi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