message-accumulator
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -20,3 +20,4 @@ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if('value'in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor}}();/** | ||
*/var _ilibTreeNode=require('ilib-tree-node');var _ilibTreeNode2=_interopRequireDefault(_ilibTreeNode);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function')}}// take care of all Unicode whitespace as well as what JS thinks is whitespace | ||
var whiteSpaceStart=/^[\t-\r \xA0\u1680\u2000-\u200D\u2028\u2029\u202F\u205F\u2060\u3000\uFEFF]+/;var whiteSpaceEnd=/[\t-\r \xA0\u1680\u2000-\u200D\u2028\u2029\u202F\u205F\u2060\u3000\uFEFF]+$/;var whiteSpace=/[\t-\r \xA0\u1680\u2000-\u200D\u2028\u2029\u202F\u205F\u2060\u3000\uFEFF]+/g;/** | ||
var whiteSpaceStart=/^[\t-\r \xA0\u1680\u2000-\u200D\u2028\u2029\u202F\u205F\u2060\u3000\uFEFF]+/;var whiteSpaceEnd=/[\t-\r \xA0\u1680\u2000-\u200D\u2028\u2029\u202F\u205F\u2060\u3000\uFEFF]+$/;var whiteSpace=/[\t-\r \xA0\u1680\u2000-\u200D\u2028\u2029\u202F\u205F\u2060\u3000\uFEFF]+/g;// use [\s\S]*? instead of .* with the "s" flag because node 6 and earlier throw errors about the unknown "s" flag | ||
var re=/(<(c\d+)>[\s\S]*?<\/\2>)/g;var first=/^<c(\d+)>/;var selfclosing=/(<c(\d+)\/>)/g;/** | ||
* MessageAccumulator.js - accumulate a translatable message as a string | ||
@@ -39,3 +40,3 @@ */var MessageAccumulator=function(){/** | ||
* @private | ||
*/value:function _parse(string,mapping,parent){var match=void 0,re=/(<(c\d+)>.*<\/\2>)/gs,first=/^<c(\d+)>/,selfclosing=/(<c(\d+)\/>)/g;var parts=string.split(re);for(var i=0;i<parts.length;i++){first.lastIndex=0;selfclosing.lastIndex=0;if((match=first.exec(parts[i]))!==null){var index=match[1];var len=match[0].length;// strip off the outer tags before processing the stuff in the middle | ||
*/value:function _parse(string,mapping,parent){var match=void 0;re.lastIndex=0;var parts=string.split(re);for(var i=0;i<parts.length;i++){first.lastIndex=0;selfclosing.lastIndex=0;if((match=first.exec(parts[i]))!==null){var index=match[1];var len=match[0].length;// strip off the outer tags before processing the stuff in the middle | ||
var substr=parts[i].substring(len,parts[i].length-len-1);var component=new _ilibTreeNode2.default({type:'component',parent:parent,index:index,extra:mapping&&mapping['c'+index]});this._parse(substr,mapping,component);parent.add(component);i++;// skip the number in the next iteration | ||
@@ -42,0 +43,0 @@ }else if(parts[i]&&parts[i].length){var subparts=parts[i].split(selfclosing);for(var j=0;j<subparts.length;j++){selfclosing.lastIndex=0;if((match=selfclosing.exec(subparts[j]))!==null){var _index=match[2];parent.add(new _ilibTreeNode2.default({type:'component',parent:parent,index:_index,extra:mapping&&mapping['c'+_index]}));j++;// skip the number in the next iteration |
@@ -24,6 +24,11 @@ /** | ||
// take care of all Unicode whitespace as well as what JS thinks is whitespace | ||
var whiteSpaceStart = /^[\s\u2000-\u200D\u2028\u2029\u202F\u205F\u2060]+/u; | ||
var whiteSpaceEnd = /[\s\u2000-\u200D\u2028\u2029\u202F\u205F\u2060]+$/u; | ||
var whiteSpace = /[\s\u2000-\u200D\u2028\u2029\u202F\u205F\u2060]+/ug; | ||
let whiteSpaceStart = /^[\s\u2000-\u200D\u2028\u2029\u202F\u205F\u2060]+/u; | ||
let whiteSpaceEnd = /[\s\u2000-\u200D\u2028\u2029\u202F\u205F\u2060]+$/u; | ||
let whiteSpace = /[\s\u2000-\u200D\u2028\u2029\u202F\u205F\u2060]+/ug; | ||
// use [\s\S]*? instead of .* with the "s" flag because node 6 and earlier throw errors about the unknown "s" flag | ||
let re = /(<(c\d+)>[\s\S]*?<\/\2>)/g; | ||
let first = /^<c(\d+)>/; | ||
let selfclosing = /(<c(\d+)\/>)/g; | ||
/** | ||
@@ -73,7 +78,5 @@ * MessageAccumulator.js - accumulate a translatable message as a string | ||
_parse(string, mapping, parent) { | ||
let match, | ||
re = /(<(c\d+)>.*<\/\2>)/gs, | ||
first = /^<c(\d+)>/, | ||
selfclosing = /(<c(\d+)\/>)/g; | ||
let match; | ||
re.lastIndex = 0; | ||
let parts = string.split(re); | ||
@@ -80,0 +83,0 @@ |
{ | ||
"name": "message-accumulator", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"main": "./message-accumulator-es5.js", | ||
@@ -5,0 +5,0 @@ "main-es6": "./message-accumulator.js", |
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
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
76989
589