fluent-syntax
Advanced tools
Comparing version 0.8.0 to 0.8.1
# Changelog | ||
## fluent-syntax 0.8.1 (August 1, 2018) | ||
### Bug fixes | ||
- Avoid forEach to make code minification-friendly. (#263) | ||
- Don't call charCodeAt() on undefined when at EOF. (#265) | ||
## fluent-syntax 0.8.0 (July 24, 2018) | ||
@@ -4,0 +11,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* fluent-syntax@0.8.0 */ | ||
/* fluent-syntax@0.8.1 */ | ||
(function (global, factory) { | ||
@@ -731,7 +731,10 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
isNumberStart() { | ||
if (this.currentIs("-")) { | ||
this.peek(); | ||
const ch = this.currentIs("-") ? this.peek() : this.current(); | ||
if (ch === undefined) { | ||
this.resetPeek(); | ||
return false; | ||
} | ||
const cc = this.currentPeek().charCodeAt(0); | ||
const cc = ch.charCodeAt(0); | ||
const isDigit = cc >= 48 && cc <= 57; // 0-9 | ||
@@ -982,3 +985,8 @@ | ||
["getComment", "getMessage", "getTerm", "getAttribute", "getIdentifier", "getTermIdentifier", "getVariant", "getVariantName", "getNumber", "getValue", "getPattern", "getVariantList", "getTextElement", "getPlaceable", "getExpression", "getSelectorExpression", "getCallArg", "getString", "getLiteral", "getVariantList"].forEach(name => this[name] = withSpan(this[name])); | ||
const methodNames = ["getComment", "getMessage", "getTerm", "getAttribute", "getIdentifier", "getTermIdentifier", "getVariant", "getVariantName", "getNumber", "getValue", "getPattern", "getVariantList", "getTextElement", "getPlaceable", "getExpression", "getSelectorExpression", "getCallArg", "getString", "getLiteral", "getVariantList"]; | ||
for (var _i = 0; _i < methodNames.length; _i++) { | ||
const name = methodNames[_i]; | ||
this[name] = withSpan(this[name]); | ||
} | ||
} | ||
@@ -985,0 +993,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* fluent-syntax@0.8.0 */ | ||
/* fluent-syntax@0.8.1 */ | ||
(function (global, factory) { | ||
@@ -626,7 +626,12 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
isNumberStart() { | ||
if (this.currentIs("-")) { | ||
this.peek(); | ||
const ch = this.currentIs("-") | ||
? this.peek() | ||
: this.current(); | ||
if (ch === undefined) { | ||
this.resetPeek(); | ||
return false; | ||
} | ||
const cc = this.currentPeek().charCodeAt(0); | ||
const cc = ch.charCodeAt(0); | ||
const isDigit = cc >= 48 && cc <= 57; // 0-9 | ||
@@ -879,3 +884,3 @@ this.resetPeek(); | ||
// Poor man's decorators. | ||
[ | ||
const methodNames = [ | ||
"getComment", "getMessage", "getTerm", "getAttribute", "getIdentifier", | ||
@@ -886,5 +891,6 @@ "getTermIdentifier", "getVariant", "getVariantName", "getNumber", | ||
"getString", "getLiteral", "getVariantList" | ||
].forEach( | ||
name => this[name] = withSpan(this[name]) | ||
); | ||
]; | ||
for (const name of methodNames) { | ||
this[name] = withSpan(this[name]); | ||
} | ||
} | ||
@@ -891,0 +897,0 @@ |
{ | ||
"name": "fluent-syntax", | ||
"description": "AST and parser for Fluent", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"homepage": "http://projectfluent.org", | ||
@@ -6,0 +6,0 @@ "author": "Mozilla <l10n-drivers@mozilla.org>", |
@@ -123,7 +123,12 @@ /* eslint no-magic-numbers: "off" */ | ||
isNumberStart() { | ||
if (this.currentIs("-")) { | ||
this.peek(); | ||
const ch = this.currentIs("-") | ||
? this.peek() | ||
: this.current(); | ||
if (ch === undefined) { | ||
this.resetPeek(); | ||
return false; | ||
} | ||
const cc = this.currentPeek().charCodeAt(0); | ||
const cc = ch.charCodeAt(0); | ||
const isDigit = cc >= 48 && cc <= 57; // 0-9 | ||
@@ -130,0 +135,0 @@ this.resetPeek(); |
@@ -40,3 +40,3 @@ /* eslint no-magic-numbers: [0] */ | ||
// Poor man's decorators. | ||
[ | ||
const methodNames = [ | ||
"getComment", "getMessage", "getTerm", "getAttribute", "getIdentifier", | ||
@@ -47,5 +47,6 @@ "getTermIdentifier", "getVariant", "getVariantName", "getNumber", | ||
"getString", "getLiteral", "getVariantList" | ||
].forEach( | ||
name => this[name] = withSpan(this[name]) | ||
); | ||
]; | ||
for (const name of methodNames) { | ||
this[name] = withSpan(this[name]); | ||
} | ||
} | ||
@@ -52,0 +53,0 @@ |
148000
4981