angular-message-format
Advanced tools
Comparing version 1.5.8 to 1.6.0-rc.0
/** | ||
* @license AngularJS v1.5.8 | ||
* @license AngularJS v1.6.0-rc.0 | ||
* (c) 2010-2016 Google, Inc. http://angularjs.org | ||
@@ -16,12 +16,4 @@ * License: MIT | ||
/* global toJson: false */ | ||
/* global $$stringify: false */ | ||
function stringify(value) { | ||
if (value == null /* null/undefined */) { return ''; } | ||
switch (typeof value) { | ||
case 'string': return value; | ||
case 'number': return '' + value; | ||
default: return toJson(value); | ||
} | ||
} | ||
// Convert an index into the string into line/column for use in error messages | ||
@@ -31,4 +23,4 @@ // As such, this doesn't have to be efficient. | ||
var lines = text.split(/\n/g); | ||
for (var i=0; i < lines.length; i++) { | ||
var line=lines[i]; | ||
for (var i = 0; i < lines.length; i++) { | ||
var line = lines[i]; | ||
if (index >= line.length) { | ||
@@ -52,3 +44,3 @@ index -= line.length; | ||
function textLiteralWatcher() { | ||
if (isFunction(listener)) { listener.call(null, text, text, scope); } | ||
if (isFunction(listener)) { listener(text, text, scope); } | ||
unwatch(); | ||
@@ -70,3 +62,3 @@ }, | ||
function minusOffset(value) { | ||
return (value == void 0) ? value : value - offset; | ||
return (value == null) ? value : value - offset; | ||
} | ||
@@ -78,3 +70,3 @@ function parsedFn(context) { return minusOffset(expressionFn(context)); } | ||
function pluralExpressionWatchListener(newValue, oldValue) { | ||
if (isFunction(listener)) { listener.call(null, minusOffset(newValue), minusOffset(oldValue), scope); } | ||
if (isFunction(listener)) { listener(minusOffset(newValue), minusOffset(oldValue), scope); } | ||
}, | ||
@@ -104,3 +96,3 @@ objectEquality); | ||
this.choices = choices; | ||
if (choices["other"] === void 0) { | ||
if (choices['other'] === undefined) { | ||
throw $interpolateMinErr('reqother', '“other” is a required option.'); | ||
@@ -139,3 +131,3 @@ } | ||
this.objectEquality = objectEquality; | ||
this.lastMessage = void 0; | ||
this.lastMessage = undefined; | ||
this.messageFnWatcher = noop; | ||
@@ -180,3 +172,3 @@ var expressionFnListener = function(newValue, oldValue) { return self.expressionFnListener(newValue, oldValue); }; | ||
SelectMessage.prototype.categorizeValue = function categorizeSelectValue(value) { | ||
return (this.choices[value] !== void 0) ? value : "other"; | ||
return (this.choices[value] !== undefined) ? value : 'other'; | ||
}; | ||
@@ -201,8 +193,8 @@ | ||
if (isNaN(value)) { | ||
return "other"; | ||
} else if (this.choices[value] !== void 0) { | ||
return 'other'; | ||
} else if (this.choices[value] !== undefined) { | ||
return value; | ||
} else { | ||
var category = this.pluralCat(value - this.offset); | ||
return (this.choices[category] !== void 0) ? category : "other"; | ||
return (this.choices[category] !== undefined) ? category : 'other'; | ||
} | ||
@@ -276,3 +268,3 @@ }; | ||
var expressionValue = expressionValues[i]; | ||
if (this.allOrNothing && expressionValue === void 0) return; | ||
if (this.allOrNothing && expressionValue === undefined) return; | ||
this.textParts[this.expressionIndices[i]] = expressionValue; | ||
@@ -288,3 +280,3 @@ } | ||
if (mustHaveExpression && this.expressionFns.length === 0) { | ||
return void 0; | ||
return undefined; | ||
} | ||
@@ -298,3 +290,3 @@ if (this.textParts.length === 0) { | ||
if (this.expressionFns.length === 0) { | ||
if (this.textParts.length != 1) { this.errorInParseLogic(); } | ||
if (this.textParts.length !== 1) { this.errorInParseLogic(); } | ||
return parseTextLiteral(this.textParts[0]); | ||
@@ -326,3 +318,3 @@ } | ||
this.scope = scope; | ||
this.previousResult = (void 0); | ||
this.previousResult = (undefined); | ||
this.listener = listener; | ||
@@ -439,3 +431,3 @@ var self = this; | ||
var match = re.exec(this.text); | ||
if (match != null && (search === true || (match.index == this.index))) { | ||
if (match != null && (search === true || (match.index === this.index))) { | ||
this.index = re.lastIndex; | ||
@@ -478,3 +470,3 @@ return match; | ||
MessageFormatParser.prototype.assertRuleOrNull = function assertRuleOrNull(rule) { | ||
if (rule === void 0) { | ||
if (rule === undefined) { | ||
this.errorInParseLogic(); | ||
@@ -495,3 +487,3 @@ } | ||
var word = match[1]; | ||
if (word == "select" || word == "plural") { | ||
if (word === 'select' || word === 'plural') { | ||
position = indexToLineAndColumn(this.text, this.index); | ||
@@ -524,3 +516,3 @@ throw $interpolateMinErr('reqcomma', | ||
this.stringQuote = match[0]; | ||
this.stringInterestsRe = this.stringQuote == "'" ? SQUOTED_STRING_INTEREST_RE : DQUOTED_STRING_INTEREST_RE; | ||
this.stringInterestsRe = this.stringQuote === '\'' ? SQUOTED_STRING_INTEREST_RE : DQUOTED_STRING_INTEREST_RE; | ||
this.rule = this.ruleInsideString; | ||
@@ -539,4 +531,3 @@ }; | ||
} | ||
var chars = match[0]; | ||
if (match == this.stringQuote) { | ||
if (match[0] === this.stringQuote) { | ||
this.rule = null; | ||
@@ -554,4 +545,4 @@ } | ||
switch (argType) { | ||
case "plural": this.rule = this.rulePluralStyle; break; | ||
case "select": this.rule = this.ruleSelectStyle; break; | ||
case 'plural': this.rule = this.rulePluralStyle; break; | ||
case 'select': this.rule = this.ruleSelectStyle; break; | ||
default: this.errorInParseLogic(); | ||
@@ -574,3 +565,3 @@ } | ||
var NUMBER_RE = /[0]|(?:[1-9][0-9]*)/g; | ||
var PLURAL_OFFSET_RE = new RegExp("\\s*offset\\s*:\\s*(" + NUMBER_RE.source + ")", "g"); | ||
var PLURAL_OFFSET_RE = new RegExp('\\s*offset\\s*:\\s*(' + NUMBER_RE.source + ')', 'g'); | ||
@@ -585,3 +576,3 @@ MessageFormatParser.prototype.rulePluralOffset = function rulePluralOffset() { | ||
MessageFormatParser.prototype.assertChoiceKeyIsNew = function assertChoiceKeyIsNew(choiceKey, index) { | ||
if (this.choices[choiceKey] !== void 0) { | ||
if (this.choices[choiceKey] !== undefined) { | ||
var position = indexToLineAndColumn(this.text, index); | ||
@@ -607,3 +598,3 @@ throw $interpolateMinErr('dupvalue', | ||
var EXPLICIT_VALUE_OR_KEYWORD_RE = new RegExp("\\s*(?:(?:=(" + NUMBER_RE.source + "))|(\\w+))", "g"); | ||
var EXPLICIT_VALUE_OR_KEYWORD_RE = new RegExp('\\s*(?:(?:=(' + NUMBER_RE.source + '))|(\\w+))', 'g'); | ||
MessageFormatParser.prototype.rulePluralValueOrKeyword = function rulePluralValueOrKeyword() { | ||
@@ -625,3 +616,3 @@ var match = this.matchRe(EXPLICIT_VALUE_OR_KEYWORD_RE); | ||
var BRACE_OPEN_RE = /\s*{/g; | ||
var BRACE_OPEN_RE = /\s*\{/g; | ||
var BRACE_CLOSE_RE = /}/g; | ||
@@ -646,3 +637,3 @@ MessageFormatParser.prototype.ruleMessageText = function ruleMessageText() { | ||
MessageFormatParser.prototype.advanceInInterpolationOrMessageText = function advanceInInterpolationOrMessageText() { | ||
var currentIndex = this.index, match, re; | ||
var currentIndex = this.index, match; | ||
if (this.ruleChoiceKeyword == null) { // interpolation | ||
@@ -656,3 +647,3 @@ match = this.searchRe(ESCAPE_OR_MUSTACHE_BEGIN_RE); | ||
} else { | ||
match = this.searchRe(this.ruleChoiceKeyword == this.rulePluralValueOrKeyword ? | ||
match = this.searchRe(this.ruleChoiceKeyword === this.rulePluralValueOrKeyword ? | ||
INTERP_OR_PLURALVALUE_OR_END_MESSAGE_RE : INTERP_OR_END_MESSAGE_RE); | ||
@@ -682,3 +673,3 @@ if (match == null) { | ||
} | ||
if (token[0] == "\\") { | ||
if (token[0] === '\\') { | ||
// unescape next character and continue | ||
@@ -689,10 +680,10 @@ this.interpolationParts.addText(this.textPart + token[1]); | ||
this.interpolationParts.addText(this.textPart); | ||
if (token == "{{") { | ||
if (token === '{{') { | ||
this.pushState(); | ||
this.ruleStack.push(this.ruleEndMustacheInInterpolationOrMessage); | ||
this.rule = this.ruleEnteredMustache; | ||
} else if (token == "}") { | ||
} else if (token === '}') { | ||
this.choices[this.choiceKey] = this.interpolationParts.toParsedFn(/*mustHaveExpression=*/false, this.text); | ||
this.rule = this.ruleChoiceKeyword; | ||
} else if (token == "#") { | ||
} else if (token === '#') { | ||
this.interpolationParts.addExpressionFn(this.expressionMinusOffsetFn); | ||
@@ -721,3 +712,3 @@ } else { | ||
var token = match[0]; | ||
if (token[0] == "\\") { | ||
if (token[0] === '\\') { | ||
// unescape next character and continue | ||
@@ -788,5 +779,5 @@ this.interpolationParts.addText(this.text.substring(currentIndex, match.index) + token[1]); | ||
switch (opBegin) { | ||
case "{": return "}"; | ||
case "[": return "]"; | ||
case "(": return ")"; | ||
case '{': return '}'; | ||
case '[': return ']'; | ||
case '(': return ')'; | ||
default: return null; | ||
@@ -798,5 +789,5 @@ } | ||
switch (opEnd) { | ||
case "}": return "{"; | ||
case "]": return "["; | ||
case ")": return "("; | ||
case '}': return '{'; | ||
case ']': return '['; | ||
case ')': return '('; | ||
default: return null; | ||
@@ -811,3 +802,2 @@ } | ||
MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularExpression() { | ||
var startIndex = this.index; | ||
var match = this.searchRe(INTERESTING_OPERATORS_RE); | ||
@@ -837,3 +827,3 @@ var position; | ||
var operator = match[0]; | ||
if (operator == "'" || operator == '"') { | ||
if (operator === '\'' || operator === '"') { | ||
this.ruleStack.push(this.ruleInAngularExpression); | ||
@@ -843,3 +833,3 @@ this.startStringAtMatch(match); | ||
} | ||
if (operator == ",") { | ||
if (operator === ',') { | ||
if (this.trustedContext) { | ||
@@ -872,3 +862,3 @@ position = indexToLineAndColumn(this.text, this.index); | ||
if (this.angularOperatorStack.length > 0) { | ||
if (beginOperator == this.angularOperatorStack[0]) { | ||
if (beginOperator === this.angularOperatorStack[0]) { | ||
this.angularOperatorStack.shift(); | ||
@@ -901,3 +891,2 @@ return; | ||
/* global MessageFormatParser: false */ | ||
/* global stringify: false */ | ||
@@ -947,5 +936,5 @@ /** | ||
* | ||
* var alice = new Person("Alice", "female"), | ||
* bob = new Person("Bob", "male"), | ||
* ashley = new Person("Ashley", ""); | ||
* var alice = new Person('Alice', 'female'), | ||
* bob = new Person('Bob', 'male'), | ||
* ashley = new Person('Ashley', ''); | ||
* | ||
@@ -991,7 +980,7 @@ * angular.module('msgFmtExample', ['ngMessageFormat']) | ||
* | ||
* var alice = new Person("Alice", "female"), | ||
* bob = new Person("Bob", "male"), | ||
* sarah = new Person("Sarah", "female"), | ||
* harry = new Person("Harry Potter", "male"), | ||
* ashley = new Person("Ashley", ""); | ||
* var alice = new Person('Alice', 'female'), | ||
* bob = new Person('Bob', 'male'), | ||
* sarah = new Person('Sarah', 'female'), | ||
* harry = new Person('Harry Potter', 'male'), | ||
* ashley = new Person('Ashley', ''); | ||
* | ||
@@ -1052,6 +1041,6 @@ * angular.module('msgFmtExample', ['ngMessageFormat']) | ||
* | ||
* var alice = new Person("Alice", "female"), | ||
* bob = new Person("Bob", "male"), | ||
* harry = new Person("Harry Potter", "male"), | ||
* ashley = new Person("Ashley", ""); | ||
* var alice = new Person('Alice', 'female'), | ||
* bob = new Person('Bob', 'male'), | ||
* harry = new Person('Harry Potter', 'male'), | ||
* ashley = new Person('Ashley', ''); | ||
* | ||
@@ -1069,3 +1058,3 @@ * angular.module('msgFmtExample', ['ngMessageFormat']) | ||
var $$MessageFormatFactory = ['$parse', '$locale', '$sce', '$exceptionHandler', function $$messageFormat( | ||
$parse, $locale, $sce, $exceptionHandler) { | ||
$parse, $locale, $sce, $exceptionHandler) { | ||
@@ -1076,3 +1065,3 @@ function getStringifier(trustedContext, allOrNothing, text) { | ||
value = trustedContext ? $sce['getTrusted'](trustedContext, value) : $sce['valueOf'](value); | ||
return allOrNothing && (value === void 0) ? value : stringify(value); | ||
return allOrNothing && (value === undefined) ? value : $$stringify(value); | ||
} catch (err) { | ||
@@ -1098,3 +1087,3 @@ $exceptionHandler($interpolateMinErr['interr'](text, err)); | ||
var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpolateDecorator($$messageFormat, $interpolate) { | ||
if ($interpolate['startSymbol']() != "{{" || $interpolate['endSymbol']() != "}}") { | ||
if ($interpolate['startSymbol']() !== '{{' || $interpolate['endSymbol']() !== '}}') { | ||
throw $interpolateMinErr('nochgmustache', 'angular-message-format.js currently does not allow you to use custom start and end symbols for interpolation.'); | ||
@@ -1112,2 +1101,3 @@ } | ||
var toJson; | ||
var $$stringify; | ||
@@ -1121,2 +1111,3 @@ var module = window['angular']['module']('ngMessageFormat', ['ng']); | ||
toJson = window['angular']['toJson']; | ||
$$stringify = window['angular']['$$stringify']; | ||
@@ -1123,0 +1114,0 @@ $provide['decorator']('$interpolate', $$interpolateDecorator); |
/* | ||
AngularJS v1.5.8 | ||
AngularJS v1.6.0-rc.0 | ||
(c) 2010-2016 Google, Inc. http://angularjs.org | ||
License: MIT | ||
*/ | ||
(function(l){'use strict';function D(a){if(null==a)return"";switch(typeof a){case "string":return a;case "number":return""+a;default:return v(a)}}function f(a,b){for(var d=a.split(/\n/g),k=0;k<d.length;k++){var c=d[k];if(b>=c.length)b-=c.length;else return{h:k+1,f:b+1}}}function w(a){function b(){return a}var d=x[a];if(null!=d)return d;b.$$watchDelegate=function(b,d,c){var e=b.$watch(q,function(){m(d)&&d.call(null,a,a,b);e()},c);return e};x[a]=b;b.exp=a;b.expressions=[];return b}function F(a,b){function d(a){return void 0== | ||
a?a:a-b}function c(b){return d(a(b))}if(0===b)return a;var e;c.$$watchDelegate=function(b,c,k){return e=b.$watch(a,function(a,k){m(c)&&c.call(null,d(a),d(k),b)},k)};return c}function h(a,b){var d=this;this.b=a;this.e=b;if(void 0===b.other)throw e("reqother");this.d=function(a){return d.D(a)};this.d.$$watchDelegate=function(a,b,c){return d.P(a,b,c)};this.d.exp=a.exp;this.d.expressions=a.expressions}function p(a,b,d,c){var e=this;this.scope=b;this.oa=a;this.v=d;this.qa=c;this.U=void 0;this.K=q;this.ka= | ||
b.$watch(a.b,function(a){return e.ja(a)},c)}function r(a,b){h.call(this,a,b)}function y(){}function s(a,b,d,c){h.call(this,a,b);this.offset=d;this.M=c}function z(){}function g(a,b){this.u=a;this.B=b;this.i=[];this.g=[];this.J=[];this.s="";this.q=null}function t(a,b,d){this.c=a;this.scope=b;this.W=void 0;this.v=d;var c=this;this.la=b.$watchGroup(a.g,function(a,b){c.Ea(a,b)})}function u(a,b){b.b=a.b;b.C=a.C;b.w=a.w;b.e=a.e;b.k=a.k;b.c=a.c;b.n=a.n;b.F=a.F;b.l=a.l}function A(a){u(a,this)}function c(a, | ||
b,d,c,e,E,f,g){this.text=a;this.index=b||0;this.A=d;this.M=c;this.Da=e;this.pa=!!E;this.u=f;this.B=!!g;this.F=this.c=this.k=this.e=this.w=this.C=this.b=null;this.L=[];this.G=this.j=this.ca=this.O=this.da=this.l=this.n=this.o=this.a=this.d=null}function B(a){switch(a){case "{":return"}";case "[":return"]";case "(":return")";default:return null}}function G(a){switch(a){case "}":return"{";case "]":return"[";case ")":return"(";default:return null}}var x=Object.create(null);h.prototype.T=function(a){return this.e[this.R(a)]}; | ||
h.prototype.D=function(a){return this.T(this.b(a))(a)};h.prototype.P=function(a,b,d){var c=new p(this,a,b,d);return function(){c.I()}};p.prototype.ja=function(a){var b=this;this.K();a=this.oa.T(a);this.K=this.scope.$watch(a,function(a,c){return b.na(a,c)},this.qa)};p.prototype.na=function(a,b){m(this.v)&&this.v.call(null,a,a===b?a:this.U,this.scope);this.U=a};p.prototype.I=function(){this.ka();this.K()};y.prototype=h.prototype;r.prototype=new y;r.prototype.R=function(a){return void 0!==this.e[a]? | ||
a:"other"};z.prototype=h.prototype;s.prototype=new z;s.prototype.R=function(a){if(isNaN(a))return"other";if(void 0!==this.e[a])return a;a=this.M(a-this.offset);return void 0!==this.e[a]?a:"other"};g.prototype.S=function(){this.s&&(null==this.q?this.i.push(this.s):(this.i.push(this.q.join("")),this.q=null),this.s="")};g.prototype.p=function(a){a.length&&(this.s?this.q?this.q.push(a):this.q=[this.s,a]:this.s=a)};g.prototype.H=function(a){this.S();this.J.push(this.i.length);this.g.push(a);this.i.push("")}; | ||
g.prototype.ma=function(a){for(var b=Array(this.g.length),d=0;d<this.g.length;d++)b[d]=this.g[d](a);return b};g.prototype.D=function(a){for(var b=0;b<this.J.length;b++){var d=a[b];if(this.B&&void 0===d)return;this.i[this.J[b]]=d}return this.i.join("")};g.prototype.ea=function(a,b){var d=this;this.S();if(!a||0!==this.g.length){if(0===this.i.length)return w("");this.u&&1<this.i.length&&e.throwNoconcat(b);if(0===this.g.length)return 1!=this.i.length&&this.r(),w(this.i[0]);var c=function(a){return d.D(d.ma(a))}; | ||
c.$$watchDelegate=function(a,b,c){return d.P(a,b,c)};c.exp=b;c.expressions=Array(this.g.length);for(var f=0;f<this.g.length;f++)c.expressions[f]=this.g[f].exp;return c}};g.prototype.P=function(a,b){var c=new t(this,a,b);return function(){c.I()}};t.prototype.Ea=function(a,b){var c=this.c.D(a);m(this.v)&&this.v.call(null,c,a===b?c:this.W,this.scope);this.W=c};t.prototype.I=function(){this.la()};var H=new A(new c("",0,null,null,null,!1,null,!1));c.prototype.pushState=function(){this.L.push(new A(this)); | ||
u(H,this)};c.prototype.V=function(){0===this.L.length&&this.r();var a=this.L.pop();u(a,this)};c.prototype.m=function(a,b){a.lastIndex=this.index;var c=a.exec(this.text);return null==c||!0!==b&&c.index!=this.index?null:(this.index=a.lastIndex,c)};c.prototype.t=function(a){return this.m(a,!0)};c.prototype.ha=function(a){return!!this.m(a)};c.prototype.Ba=function(a){this.o=[a];do{for(this.a=this.o.pop();this.a;)this.a();this.ga(this.a)}while(0<this.o.length)};c.prototype.r=function(){throw e("logicbug", | ||
this.text);};c.prototype.ga=function(a){void 0===a&&this.r()};var I=/\s*(\w+)\s*/g;c.prototype.ia=function(){var a=this.m(I);if(null==a)throw a=f(this.text,this.index),e("reqarg",a.h,a.f,this.text);var b=a[1];if("select"==b||"plural"==b)throw a=f(this.text,this.index),e("reqcomma",b,a.h,a.f,this.text);a=f(this.text,this.index);throw e("unknarg",b,a.h,a.f,this.text);};c.prototype.Ca=function(a){this.da=a.index;this.O=a[0];this.ca="'"==this.O?J:K;this.a=this.ua};var J=/\\(?:\\|'|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|[0-7]{3}|\r\n|\n|[\s\S])|'/g, | ||
K=/\\(?:\\|"|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|[0-7]{3}|\r\n|\n|[\s\S])|"/g;c.prototype.ua=function(){var a=this.t(this.ca);if(null==a)throw a=f(this.text,this.da),e("untermstr",a.h,a.f,this.text);a==this.O&&(this.a=null)};var L=/\s*(plural|select)\s*,\s*/g;c.prototype.ya=function(){var a=this.t(L);null==a&&this.ia();switch(a[1]){case "plural":this.a=this.za;break;case "select":this.a=this.Aa;break;default:this.r()}};c.prototype.za=function(){this.e=Object.create(null);this.n=this.N;this.a=this.xa}; | ||
c.prototype.Aa=function(){this.e=Object.create(null);this.a=this.n=this.ba};var n=/[0]|(?:[1-9][0-9]*)/g,M=new RegExp("\\s*offset\\s*:\\s*("+n.source+")","g");c.prototype.xa=function(){var a=this.m(M);this.w=null==a?0:parseInt(a[1],10);this.C=F(this.b,this.w);this.a=this.N};c.prototype.Q=function(a,b){if(void 0!==this.e[a]){var c=f(this.text,b);throw e("dupvalue",a,c.h,c.f,this.text);}};var N=/\s*(\w+)/g;c.prototype.ba=function(){var a=this.m(N);null==a?(this.d=(new r(this.b,this.e)).d,this.a=null): | ||
(this.k=a[1],this.Q(this.k,a.index),this.a=this.aa)};var O=new RegExp("\\s*(?:(?:=("+n.source+"))|(\\w+))","g");c.prototype.N=function(){var a=this.m(O);null==a?(this.d=(new s(this.b,this.e,this.w,this.M)).d,this.a=null):(this.k=null!=a[1]?parseInt(a[1],10):a[2],this.Q(this.k,a.index),this.a=this.aa)};var P=/\s*{/g;c.prototype.aa=function(){if(!this.ha(P)){var a=f(this.text,this.index);throw e("reqopenbrace",this.k,a.h,a.f,this.text);}this.F=this.index;this.c=new g(this.u,this.B);this.a=this.$};var Q= | ||
/\\.|{{|}/g,R=/\\.|{{|#|}/g,C=/\\.|{{/g;c.prototype.fa=function(){var a=this.index,b;if(null==this.n){if(b=this.t(C),null==b)return this.G=this.text.substring(a),this.index=this.text.length,null}else if(b=this.t(this.n==this.N?R:Q),null==b)throw a=f(this.text,this.F),e("reqendbrace",this.k,a.h,a.f,this.text);var c=b[0];this.G=this.text.substring(a,b.index);return c};c.prototype.$=function(){var a=this.index,b=this.fa();null==b?(this.index=this.text.length,this.c.p(this.text.substring(a)),this.a=null): | ||
"\\"==b[0]?this.c.p(this.G+b[1]):(this.c.p(this.G),"{{"==b?(this.pushState(),this.o.push(this.ta),this.a=this.X):"}"==b?(this.e[this.k]=this.c.ea(!1,this.text),this.a=this.n):"#"==b?this.c.H(this.C):this.r())};c.prototype.va=function(){this.c=new g(this.u,this.B);this.a=this.Z};c.prototype.Z=function(){var a=this.index,b=this.t(C);if(null==b)this.index=this.text.length,this.c.p(this.text.substring(a)),this.d=this.c.ea(this.pa,this.text),this.a=null;else{var c=b[0];"\\"==c[0]?this.c.p(this.text.substring(a, | ||
b.index)+c[1]):(this.c.p(this.text.substring(a,b.index)),this.pushState(),this.o.push(this.wa),this.a=this.X)}};c.prototype.wa=function(){var a=this.d;this.V();this.c.H(a);this.a=this.Z};c.prototype.X=function(){this.d=null;this.o.push(this.sa);this.a=this.ra};c.prototype.ta=function(){var a=this.d;this.V();this.c.H(a);this.a=this.$};var S=/\s*}}/g;c.prototype.sa=function(){if(null==this.m(S)){var a=f(this.text,this.index);throw e("reqendinterp","}}",a.h,a.f,this.text);}null==this.d&&(this.d=this.A(this.b, | ||
this.Da),this.d.exp=this.b.exp,this.d.expressions=this.b.expressions);this.a=null};c.prototype.ra=function(){this.j=[];this.l=this.index;this.a=this.Y};var T=/[[\]{}()'",]/g;c.prototype.Y=function(){var a=this.t(T);if(null==a){if(0===this.j.length){this.index=this.text.length;this.b=this.A(this.text.substring(this.l,this.index));this.b.exp=this.text.substring(this.l,this.index);this.b.expressions=this.b.expressions;this.a=null;return}throw e("badexpr",this.Ga(this.j[0]),this.text);}var b=a[0];if("'"== | ||
b||'"'==b)this.o.push(this.Y),this.Ca(a);else if(","==b){if(this.u)throw a=f(this.text,this.index),e("unsafe",this.u,a.h,a.f,this.text);0===this.j.length&&(this.b=this.A(this.text.substring(this.l,a.index)),this.b.exp=this.text.substring(this.l,a.index),this.b.expressions=this.b.expressions,this.a=null,this.a=this.ya)}else if(null!=B(b))this.j.unshift(b);else{var c=G(b);null==c&&this.r();if(0<this.j.length){if(c==this.j[0]){this.j.shift();return}a=f(this.text,this.index);throw e("badexpr",b,a.h,a.f, | ||
B(this.j[0]),this.text);}this.index=a.index;this.b=this.A(this.text.substring(this.l,this.index));this.b.exp=this.text.substring(this.l,this.index);this.b.expressions=this.b.expressions;this.a=null}};var U=["$$messageFormat","$delegate",function(a,b){if("{{"!=b.startSymbol()||"}}"!=b.endSymbol())throw e("nochgmustache");var c=a.interpolate;c.startSymbol=b.startSymbol;c.endSymbol=b.endSymbol;return c}],e,m,q,v,n=l.angular.module("ngMessageFormat",["ng"]);n.factory("$$messageFormat",["$parse","$locale", | ||
"$sce","$exceptionHandler",function(a,b,d,f){function g(a,b,c){return function(g){try{return g=a?d.getTrusted(a,g):d.valueOf(g),b&&void 0===g?g:D(g)}catch(h){f(e.interr(c,h))}}}return{interpolate:function(d,e,f,h){d=new c(d,0,a,b.pluralCat,g(f,h,d),e,f,h);d.Ba(d.va);return d.d}}}]);n.config(["$provide",function(a){e=l.angular.$interpolateMinErr;m=l.angular.isFunction;q=l.angular.noop;v=l.angular.toJson;a.decorator("$interpolate",U)}])})(window,window.Fa); | ||
(function(k){'use strict';function f(a,b){for(var c=a.split(/\n/g),n=0;n<c.length;n++){var d=c[n];if(b>=d.length)b-=d.length;else return{h:n+1,f:b+1}}}function w(a){function b(){return a}var c=x[a];if(null!=c)return c;b.$$watchDelegate=function(b,c,d){var e=b.$watch(r,function(){l(c)&&c(a,a,b);e()},d);return e};x[a]=b;b.exp=a;b.expressions=[];return b}function E(a,b){function c(c){c=a(c);return null==c?c:c-b}if(0===b)return a;var d;c.$$watchDelegate=function(c,p,e){return d=c.$watch(a,function(a, | ||
d){l(p)&&p(null==a?a:a-b,null==d?d:d-b,c)},e)};return c}function h(a,b){var c=this;this.b=a;this.e=b;if(void 0===b.other)throw e("reqother");this.d=function(a){return c.D(a)};this.d.$$watchDelegate=function(a,b,d){return c.P(a,b,d)};this.d.exp=a.exp;this.d.expressions=a.expressions}function q(a,b,c,d){var e=this;this.scope=b;this.oa=a;this.v=c;this.qa=d;this.U=void 0;this.K=r;this.ka=b.$watch(a.b,function(a){return e.ja(a)},d)}function s(a,b){h.call(this,a,b)}function y(){}function t(a,b,c,d){h.call(this, | ||
a,b);this.offset=c;this.M=d}function z(){}function g(a,b){this.u=a;this.B=b;this.i=[];this.g=[];this.J=[];this.s="";this.q=null}function u(a,b,c){this.c=a;this.scope=b;this.W=void 0;this.v=c;var d=this;this.la=b.$watchGroup(a.g,function(a,b){d.Ea(a,b)})}function v(a,b){b.b=a.b;b.C=a.C;b.w=a.w;b.e=a.e;b.k=a.k;b.c=a.c;b.n=a.n;b.F=a.F;b.l=a.l}function A(a){v(a,this)}function d(a,b,c,d,e,p,f,g){this.text=a;this.index=b||0;this.A=c;this.M=d;this.Da=e;this.pa=!!p;this.u=f;this.B=!!g;this.F=this.c=this.k= | ||
this.e=this.w=this.C=this.b=null;this.L=[];this.G=this.j=this.ca=this.O=this.da=this.l=this.n=this.o=this.a=this.d=null}function B(a){switch(a){case "{":return"}";case "[":return"]";case "(":return")";default:return null}}function F(a){switch(a){case "}":return"{";case "]":return"[";case ")":return"(";default:return null}}var x=Object.create(null);h.prototype.T=function(a){return this.e[this.R(a)]};h.prototype.D=function(a){return this.T(this.b(a))(a)};h.prototype.P=function(a,b,c){var d=new q(this, | ||
a,b,c);return function(){d.I()}};q.prototype.ja=function(a){var b=this;this.K();a=this.oa.T(a);this.K=this.scope.$watch(a,function(a,d){return b.na(a,d)},this.qa)};q.prototype.na=function(a,b){l(this.v)&&this.v.call(null,a,a===b?a:this.U,this.scope);this.U=a};q.prototype.I=function(){this.ka();this.K()};y.prototype=h.prototype;s.prototype=new y;s.prototype.R=function(a){return void 0!==this.e[a]?a:"other"};z.prototype=h.prototype;t.prototype=new z;t.prototype.R=function(a){if(isNaN(a))return"other"; | ||
if(void 0!==this.e[a])return a;a=this.M(a-this.offset);return void 0!==this.e[a]?a:"other"};g.prototype.S=function(){this.s&&(null==this.q?this.i.push(this.s):(this.i.push(this.q.join("")),this.q=null),this.s="")};g.prototype.p=function(a){a.length&&(this.s?this.q?this.q.push(a):this.q=[this.s,a]:this.s=a)};g.prototype.H=function(a){this.S();this.J.push(this.i.length);this.g.push(a);this.i.push("")};g.prototype.ma=function(a){for(var b=Array(this.g.length),c=0;c<this.g.length;c++)b[c]=this.g[c](a); | ||
return b};g.prototype.D=function(a){for(var b=0;b<this.J.length;b++){var c=a[b];if(this.B&&void 0===c)return;this.i[this.J[b]]=c}return this.i.join("")};g.prototype.ea=function(a,b){var c=this;this.S();if(!a||0!==this.g.length){if(0===this.i.length)return w("");this.u&&1<this.i.length&&e.throwNoconcat(b);if(0===this.g.length)return 1!==this.i.length&&this.r(),w(this.i[0]);var d=function(a){return c.D(c.ma(a))};d.$$watchDelegate=function(a,b,d){return c.P(a,b,d)};d.exp=b;d.expressions=Array(this.g.length); | ||
for(var f=0;f<this.g.length;f++)d.expressions[f]=this.g[f].exp;return d}};g.prototype.P=function(a,b){var c=new u(this,a,b);return function(){c.I()}};u.prototype.Ea=function(a,b){var c=this.c.D(a);l(this.v)&&this.v.call(null,c,a===b?c:this.W,this.scope);this.W=c};u.prototype.I=function(){this.la()};var G=new A(new d("",0,null,null,null,!1,null,!1));d.prototype.pushState=function(){this.L.push(new A(this));v(G,this)};d.prototype.V=function(){0===this.L.length&&this.r();var a=this.L.pop();v(a,this)}; | ||
d.prototype.m=function(a,b){a.lastIndex=this.index;var c=a.exec(this.text);return null==c||!0!==b&&c.index!==this.index?null:(this.index=a.lastIndex,c)};d.prototype.t=function(a){return this.m(a,!0)};d.prototype.ha=function(a){return!!this.m(a)};d.prototype.Ba=function(a){this.o=[a];do{for(this.a=this.o.pop();this.a;)this.a();this.ga(this.a)}while(0<this.o.length)};d.prototype.r=function(){throw e("logicbug",this.text);};d.prototype.ga=function(a){void 0===a&&this.r()};var H=/\s*(\w+)\s*/g;d.prototype.ia= | ||
function(){var a=this.m(H);if(null==a)throw a=f(this.text,this.index),e("reqarg",a.h,a.f,this.text);var b=a[1];if("select"===b||"plural"===b)throw a=f(this.text,this.index),e("reqcomma",b,a.h,a.f,this.text);a=f(this.text,this.index);throw e("unknarg",b,a.h,a.f,this.text);};d.prototype.Ca=function(a){this.da=a.index;this.O=a[0];this.ca="'"===this.O?I:J;this.a=this.ua};var I=/\\(?:\\|'|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|[0-7]{3}|\r\n|\n|[\s\S])|'/g,J=/\\(?:\\|"|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{2}|[0-7]{3}|\r\n|\n|[\s\S])|"/g; | ||
d.prototype.ua=function(){var a=this.t(this.ca);if(null==a)throw a=f(this.text,this.da),e("untermstr",a.h,a.f,this.text);a[0]===this.O&&(this.a=null)};var K=/\s*(plural|select)\s*,\s*/g;d.prototype.ya=function(){var a=this.t(K);null==a&&this.ia();switch(a[1]){case "plural":this.a=this.za;break;case "select":this.a=this.Aa;break;default:this.r()}};d.prototype.za=function(){this.e=Object.create(null);this.n=this.N;this.a=this.xa};d.prototype.Aa=function(){this.e=Object.create(null);this.a=this.n=this.ba}; | ||
var m=/[0]|(?:[1-9][0-9]*)/g,L=new RegExp("\\s*offset\\s*:\\s*("+m.source+")","g");d.prototype.xa=function(){var a=this.m(L);this.w=null==a?0:parseInt(a[1],10);this.C=E(this.b,this.w);this.a=this.N};d.prototype.Q=function(a,b){if(void 0!==this.e[a]){var c=f(this.text,b);throw e("dupvalue",a,c.h,c.f,this.text);}};var M=/\s*(\w+)/g;d.prototype.ba=function(){var a=this.m(M);null==a?(this.d=(new s(this.b,this.e)).d,this.a=null):(this.k=a[1],this.Q(this.k,a.index),this.a=this.aa)};var N=new RegExp("\\s*(?:(?:=("+ | ||
m.source+"))|(\\w+))","g");d.prototype.N=function(){var a=this.m(N);null==a?(this.d=(new t(this.b,this.e,this.w,this.M)).d,this.a=null):(this.k=null!=a[1]?parseInt(a[1],10):a[2],this.Q(this.k,a.index),this.a=this.aa)};var O=/\s*\{/g;d.prototype.aa=function(){if(!this.ha(O)){var a=f(this.text,this.index);throw e("reqopenbrace",this.k,a.h,a.f,this.text);}this.F=this.index;this.c=new g(this.u,this.B);this.a=this.$};var P=/\\.|{{|}/g,Q=/\\.|{{|#|}/g,C=/\\.|{{/g;d.prototype.fa=function(){var a=this.index, | ||
b;if(null==this.n){if(b=this.t(C),null==b)return this.G=this.text.substring(a),this.index=this.text.length,null}else if(b=this.t(this.n===this.N?Q:P),null==b)throw a=f(this.text,this.F),e("reqendbrace",this.k,a.h,a.f,this.text);var c=b[0];this.G=this.text.substring(a,b.index);return c};d.prototype.$=function(){var a=this.index,b=this.fa();null==b?(this.index=this.text.length,this.c.p(this.text.substring(a)),this.a=null):"\\"===b[0]?this.c.p(this.G+b[1]):(this.c.p(this.G),"{{"===b?(this.pushState(), | ||
this.o.push(this.ta),this.a=this.X):"}"===b?(this.e[this.k]=this.c.ea(!1,this.text),this.a=this.n):"#"===b?this.c.H(this.C):this.r())};d.prototype.va=function(){this.c=new g(this.u,this.B);this.a=this.Z};d.prototype.Z=function(){var a=this.index,b=this.t(C);if(null==b)this.index=this.text.length,this.c.p(this.text.substring(a)),this.d=this.c.ea(this.pa,this.text),this.a=null;else{var c=b[0];"\\"===c[0]?this.c.p(this.text.substring(a,b.index)+c[1]):(this.c.p(this.text.substring(a,b.index)),this.pushState(), | ||
this.o.push(this.wa),this.a=this.X)}};d.prototype.wa=function(){var a=this.d;this.V();this.c.H(a);this.a=this.Z};d.prototype.X=function(){this.d=null;this.o.push(this.sa);this.a=this.ra};d.prototype.ta=function(){var a=this.d;this.V();this.c.H(a);this.a=this.$};var R=/\s*}}/g;d.prototype.sa=function(){if(null==this.m(R)){var a=f(this.text,this.index);throw e("reqendinterp","}}",a.h,a.f,this.text);}null==this.d&&(this.d=this.A(this.b,this.Da),this.d.exp=this.b.exp,this.d.expressions=this.b.expressions); | ||
this.a=null};d.prototype.ra=function(){this.j=[];this.l=this.index;this.a=this.Y};var S=/[[\]{}()'",]/g;d.prototype.Y=function(){var a=this.t(S);if(null==a){if(0===this.j.length){this.index=this.text.length;this.b=this.A(this.text.substring(this.l,this.index));this.b.exp=this.text.substring(this.l,this.index);this.b.expressions=this.b.expressions;this.a=null;return}throw e("badexpr",this.Ga(this.j[0]),this.text);}var b=a[0];if("'"===b||'"'===b)this.o.push(this.Y),this.Ca(a);else if(","===b){if(this.u)throw a= | ||
f(this.text,this.index),e("unsafe",this.u,a.h,a.f,this.text);0===this.j.length&&(this.b=this.A(this.text.substring(this.l,a.index)),this.b.exp=this.text.substring(this.l,a.index),this.b.expressions=this.b.expressions,this.a=null,this.a=this.ya)}else if(null!=B(b))this.j.unshift(b);else{var c=F(b);null==c&&this.r();if(0<this.j.length){if(c===this.j[0]){this.j.shift();return}a=f(this.text,this.index);throw e("badexpr",b,a.h,a.f,B(this.j[0]),this.text);}this.index=a.index;this.b=this.A(this.text.substring(this.l, | ||
this.index));this.b.exp=this.text.substring(this.l,this.index);this.b.expressions=this.b.expressions;this.a=null}};var T=["$$messageFormat","$delegate",function(a,b){if("{{"!==b.startSymbol()||"}}"!==b.endSymbol())throw e("nochgmustache");var c=a.interpolate;c.startSymbol=b.startSymbol;c.endSymbol=b.endSymbol;return c}],e,l,r,D,m=k.angular.module("ngMessageFormat",["ng"]);m.factory("$$messageFormat",["$parse","$locale","$sce","$exceptionHandler",function(a,b,c,f){function g(a,b,d){return function(g){try{return g= | ||
a?c.getTrusted(a,g):c.valueOf(g),b&&void 0===g?g:D(g)}catch(h){f(e.interr(d,h))}}}return{interpolate:function(c,e,f,h){c=new d(c,0,a,b.pluralCat,g(f,h,c),e,f,h);c.Ba(c.va);return c.d}}}]);m.config(["$provide",function(a){e=k.angular.$interpolateMinErr;l=k.angular.isFunction;r=k.angular.noop;D=k.angular.$$stringify;a.decorator("$interpolate",T)}])})(window,window.Fa); | ||
//# sourceMappingURL=angular-message-format.min.js.map |
{ | ||
"name": "angular-message-format", | ||
"version": "1.5.8", | ||
"main": "./angular-message-format.min.js", | ||
"version": "1.6.0-rc.0", | ||
"main": "./angular-message-format.js", | ||
"ignore": [], | ||
"dependencies": { | ||
"angular": "1.5.8" | ||
"angular": "1.6.0-rc.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
require('./angular-message-format.min'); | ||
require('./angular-message-format'); | ||
module.exports = 'ngMessageFormat'; |
{ | ||
"name": "angular-message-format", | ||
"version": "1.5.8", | ||
"version": "1.6.0-rc.0", | ||
"description": "AngularJS module for plural and gender MessageFormat extensions $interpolate/interpolations", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,3 +20,3 @@ # packaged angular-message-format | ||
```javascript | ||
angular.module('myApp', [require('angular-message-format.min')]); | ||
angular.module('myApp', [require('angular-message-format')]); | ||
``` | ||
@@ -33,3 +33,3 @@ | ||
```html | ||
<script src="/bower_components/angular-message-format/angular-message-format.min.js"></script> | ||
<script src="/bower_components/angular-message-format/angular-message-format.js"></script> | ||
``` | ||
@@ -36,0 +36,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
82929
1041
2