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

Function $ParseProvider

test/angular/1.7/angular.js:17299–17590  ·  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

17297 * service.
17298 */
17299function $ParseProvider() {
17300 var cache = createMap();
17301 var literals = {
17302 'true': true,
17303 'false': false,
17304 'null': null,
17305 'undefined': undefined
17306 };
17307 var identStart, identContinue;
17308
17309 /**
17310 * @ngdoc method
17311 * @name $parseProvider#addLiteral
17312 * @description
17313 *
17314 * Configure $parse service to add literal values that will be present as literal at expressions.
17315 *
17316 * @param {string} literalName Token for the literal value. The literal name value must be a valid literal name.
17317 * @param {*} literalValue Value for this literal. All literal values must be primitives or `undefined`.
17318 *
17319 **/
17320 this.addLiteral = function(literalName, literalValue) {
17321 literals[literalName] = literalValue;
17322 };
17323
17324 /**
17325 * @ngdoc method
17326 * @name $parseProvider#setIdentifierFns
17327 *
17328 * @description
17329 *
17330 * Allows defining the set of characters that are allowed in AngularJS expressions. The function
17331 * `identifierStart` will get called to know if a given character is a valid character to be the
17332 * first character for an identifier. The function `identifierContinue` will get called to know if
17333 * a given character is a valid character to be a follow-up identifier character. The functions
17334 * `identifierStart` and `identifierContinue` will receive as arguments the single character to be
17335 * identifier and the character code point. These arguments will be `string` and `numeric`. Keep in
17336 * mind that the `string` parameter can be two characters long depending on the character
17337 * representation. It is expected for the function to return `true` or `false`, whether that
17338 * character is allowed or not.
17339 *
17340 * Since this function will be called extensively, keep the implementation of these functions fast,
17341 * as the performance of these functions have a direct impact on the expressions parsing speed.
17342 *
17343 * @param {function=} identifierStart The function that will decide whether the given character is
17344 * a valid identifier start character.
17345 * @param {function=} identifierContinue The function that will decide whether the given character is
17346 * a valid identifier continue character.
17347 */
17348 this.setIdentifierFns = function(identifierStart, identifierContinue) {
17349 identStart = identifierStart;
17350 identContinue = identifierContinue;
17351 return this;
17352 };
17353
17354 this.$get = ['$filter', function($filter) {
17355 var noUnsafeEval = csp().noUnsafeEval;
17356 var $parseOptions = {

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