MCPcopy
hub / github.com/angular-ui/ui-router / $ParseProvider

Function $ParseProvider

test/angular/1.5/angular.js:16071–16379  ·  view source on GitHub ↗

* @ngdoc provider * @name $parseProvider * @this * * @description * `$parseProvider` can be used for configuring the default behavior of the ng.$parse $parse * service.

()

Source from the content-addressed store, hash-verified

16069 * service.
16070 */
16071function $ParseProvider() {
16072 var cacheDefault = createMap();
16073 var cacheExpensive = createMap();
16074 var literals = {
16075 'true': true,
16076 'false': false,
16077 'null': null,
16078 'undefined': undefined
16079 };
16080 var identStart, identContinue;
16081
16082 /**
16083 * @ngdoc method
16084 * @name $parseProvider#addLiteral
16085 * @description
16086 *
16087 * Configure $parse service to add literal values that will be present as literal at expressions.
16088 *
16089 * @param {string} literalName Token for the literal value. The literal name value must be a valid literal name.
16090 * @param {*} literalValue Value for this literal. All literal values must be primitives or `undefined`.
16091 *
16092 **/
16093 this.addLiteral = function(literalName, literalValue) {
16094 literals[literalName] = literalValue;
16095 };
16096
16097 /**
16098 * @ngdoc method
16099 * @name $parseProvider#setIdentifierFns
16100 *
16101 * @description
16102 *
16103 * Allows defining the set of characters that are allowed in Angular expressions. The function
16104 * `identifierStart` will get called to know if a given character is a valid character to be the
16105 * first character for an identifier. The function `identifierContinue` will get called to know if
16106 * a given character is a valid character to be a follow-up identifier character. The functions
16107 * `identifierStart` and `identifierContinue` will receive as arguments the single character to be
16108 * identifier and the character code point. These arguments will be `string` and `numeric`. Keep in
16109 * mind that the `string` parameter can be two characters long depending on the character
16110 * representation. It is expected for the function to return `true` or `false`, whether that
16111 * character is allowed or not.
16112 *
16113 * Since this function will be called extensively, keep the implementation of these functions fast,
16114 * as the performance of these functions have a direct impact on the expressions parsing speed.
16115 *
16116 * @param {function=} identifierStart The function that will decide whether the given character is
16117 * a valid identifier start character.
16118 * @param {function=} identifierContinue The function that will decide whether the given character is
16119 * a valid identifier continue character.
16120 */
16121 this.setIdentifierFns = function(identifierStart, identifierContinue) {
16122 identStart = identifierStart;
16123 identContinue = identifierContinue;
16124 return this;
16125 };
16126
16127 this.$get = ['$filter', function($filter) {
16128 var noUnsafeEval = csp().noUnsafeEval;

Callers

nothing calls this directly

Calls 4

createMapFunction · 0.70
cspFunction · 0.70
copyFunction · 0.70
isFunctionFunction · 0.70

Tested by

no test coverage detected