clientnode 4.0.1503 → 4.0.1505
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/index.js +10 -5
- package/dist/compatible/datetime.js +10 -5
- package/dist/compatible/expression/evaluators.js +10 -5
- package/dist/compatible/expression/index.js +10 -5
- package/dist/compatible/index.js +10 -5
- package/dist/compatible/object.js +10 -5
- package/dist/compatible/scope.js +10 -5
- package/dist/compatible/string.js +10 -5
- package/dist/datetime.js +10 -5
- package/dist/expression/evaluators.js +10 -5
- package/dist/expression/index.js +10 -5
- package/dist/index.js +10 -5
- package/dist/object.js +10 -5
- package/dist/scope.js +10 -5
- package/dist/string.d.ts +5 -4
- package/dist/string.js +10 -5
- package/dist/type.d.ts +1 -1
- package/package.json +2 -2
package/dist/bundle/index.js
CHANGED
|
@@ -2362,7 +2362,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
2362
2362
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
2363
2363
|
* html tags via "['<', '>']" (the default).
|
|
2364
2364
|
* @returns Start and end index of matching range.
|
|
2365
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
2365
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
2366
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
2367
|
+
whitespace), so the reported match index aligns with the real
|
|
2368
|
+
character.
|
|
2369
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
2366
2370
|
* Fixes known encoding problems in given data.
|
|
2367
2371
|
* @param data - To process.
|
|
2368
2372
|
* @returns Processed data.
|
|
@@ -2406,8 +2410,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
2406
2410
|
* @returns The formatted string.
|
|
2407
2411
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
2408
2412
|
* Wraps given mark strings in a given target with a given marker.
|
|
2409
|
-
* @param target - String to search
|
|
2410
|
-
* @param
|
|
2413
|
+
* @param target - String to search in.
|
|
2414
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
2415
|
+
* search for.
|
|
2411
2416
|
* @param givenOptions - Defines highlighting behavior.
|
|
2412
2417
|
* @param givenOptions.marker - HTML template string to mark.
|
|
2413
2418
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -2415,11 +2420,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
2415
2420
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
2416
2421
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
2417
2422
|
* @returns Processed result.
|
|
2418
|
-
*/var mark=function mark(target,
|
|
2423
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
2419
2424
|
Search for matches as long there is enough target text remaining to
|
|
2420
2425
|
walk through.
|
|
2421
2426
|
*/for(var iteration=0;iteration<_context_js__WEBPACK_IMPORTED_MODULE_2__/* .MAXIMAL_NUMBER_OF_ITERATIONS */ .$Q.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
2422
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
2427
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
2423
2428
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
2424
2429
|
* @param value - Number to normalize.
|
|
2425
2430
|
* @param dialable - Indicates whether the result should be dialed or
|
|
@@ -725,7 +725,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
725
725
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
726
726
|
* html tags via "['<', '>']" (the default).
|
|
727
727
|
* @returns Start and end index of matching range.
|
|
728
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
728
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
729
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
730
|
+
whitespace), so the reported match index aligns with the real
|
|
731
|
+
character.
|
|
732
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
729
733
|
* Fixes known encoding problems in given data.
|
|
730
734
|
* @param data - To process.
|
|
731
735
|
* @returns Processed data.
|
|
@@ -769,8 +773,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
769
773
|
* @returns The formatted string.
|
|
770
774
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
771
775
|
* Wraps given mark strings in a given target with a given marker.
|
|
772
|
-
* @param target - String to search
|
|
773
|
-
* @param
|
|
776
|
+
* @param target - String to search in.
|
|
777
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
778
|
+
* search for.
|
|
774
779
|
* @param givenOptions - Defines highlighting behavior.
|
|
775
780
|
* @param givenOptions.marker - HTML template string to mark.
|
|
776
781
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -778,11 +783,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
778
783
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
779
784
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
780
785
|
* @returns Processed result.
|
|
781
|
-
*/var mark=function mark(target,
|
|
786
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
782
787
|
Search for matches as long there is enough target text remaining to
|
|
783
788
|
walk through.
|
|
784
789
|
*/for(var iteration=0;iteration<MAXIMAL_NUMBER_OF_ITERATIONS.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
785
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
790
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
786
791
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
787
792
|
* @param value - Number to normalize.
|
|
788
793
|
* @param dialable - Indicates whether the result should be dialed or
|
|
@@ -731,7 +731,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
731
731
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
732
732
|
* html tags via "['<', '>']" (the default).
|
|
733
733
|
* @returns Start and end index of matching range.
|
|
734
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
734
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
735
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
736
|
+
whitespace), so the reported match index aligns with the real
|
|
737
|
+
character.
|
|
738
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
735
739
|
* Fixes known encoding problems in given data.
|
|
736
740
|
* @param data - To process.
|
|
737
741
|
* @returns Processed data.
|
|
@@ -775,8 +779,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
775
779
|
* @returns The formatted string.
|
|
776
780
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
777
781
|
* Wraps given mark strings in a given target with a given marker.
|
|
778
|
-
* @param target - String to search
|
|
779
|
-
* @param
|
|
782
|
+
* @param target - String to search in.
|
|
783
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
784
|
+
* search for.
|
|
780
785
|
* @param givenOptions - Defines highlighting behavior.
|
|
781
786
|
* @param givenOptions.marker - HTML template string to mark.
|
|
782
787
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -784,11 +789,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
784
789
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
785
790
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
786
791
|
* @returns Processed result.
|
|
787
|
-
*/var mark=function mark(target,
|
|
792
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
788
793
|
Search for matches as long there is enough target text remaining to
|
|
789
794
|
walk through.
|
|
790
795
|
*/for(var iteration=0;iteration<MAXIMAL_NUMBER_OF_ITERATIONS.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
791
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
796
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
792
797
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
793
798
|
* @param value - Number to normalize.
|
|
794
799
|
* @param dialable - Indicates whether the result should be dialed or
|
|
@@ -714,7 +714,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
714
714
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
715
715
|
* html tags via "['<', '>']" (the default).
|
|
716
716
|
* @returns Start and end index of matching range.
|
|
717
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
717
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
718
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
719
|
+
whitespace), so the reported match index aligns with the real
|
|
720
|
+
character.
|
|
721
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
718
722
|
* Fixes known encoding problems in given data.
|
|
719
723
|
* @param data - To process.
|
|
720
724
|
* @returns Processed data.
|
|
@@ -758,8 +762,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
758
762
|
* @returns The formatted string.
|
|
759
763
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
760
764
|
* Wraps given mark strings in a given target with a given marker.
|
|
761
|
-
* @param target - String to search
|
|
762
|
-
* @param
|
|
765
|
+
* @param target - String to search in.
|
|
766
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
767
|
+
* search for.
|
|
763
768
|
* @param givenOptions - Defines highlighting behavior.
|
|
764
769
|
* @param givenOptions.marker - HTML template string to mark.
|
|
765
770
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -767,11 +772,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
767
772
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
768
773
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
769
774
|
* @returns Processed result.
|
|
770
|
-
*/var mark=function mark(target,
|
|
775
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
771
776
|
Search for matches as long there is enough target text remaining to
|
|
772
777
|
walk through.
|
|
773
778
|
*/for(var iteration=0;iteration<MAXIMAL_NUMBER_OF_ITERATIONS.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
774
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
779
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
775
780
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
776
781
|
* @param value - Number to normalize.
|
|
777
782
|
* @param dialable - Indicates whether the result should be dialed or
|
package/dist/compatible/index.js
CHANGED
|
@@ -802,7 +802,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
802
802
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
803
803
|
* html tags via "['<', '>']" (the default).
|
|
804
804
|
* @returns Start and end index of matching range.
|
|
805
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
805
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
806
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
807
|
+
whitespace), so the reported match index aligns with the real
|
|
808
|
+
character.
|
|
809
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
806
810
|
* Fixes known encoding problems in given data.
|
|
807
811
|
* @param data - To process.
|
|
808
812
|
* @returns Processed data.
|
|
@@ -846,8 +850,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
846
850
|
* @returns The formatted string.
|
|
847
851
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
848
852
|
* Wraps given mark strings in a given target with a given marker.
|
|
849
|
-
* @param target - String to search
|
|
850
|
-
* @param
|
|
853
|
+
* @param target - String to search in.
|
|
854
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
855
|
+
* search for.
|
|
851
856
|
* @param givenOptions - Defines highlighting behavior.
|
|
852
857
|
* @param givenOptions.marker - HTML template string to mark.
|
|
853
858
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -855,11 +860,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
855
860
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
856
861
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
857
862
|
* @returns Processed result.
|
|
858
|
-
*/var mark=function mark(target,
|
|
863
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
859
864
|
Search for matches as long there is enough target text remaining to
|
|
860
865
|
walk through.
|
|
861
866
|
*/for(var iteration=0;iteration<_context_js__WEBPACK_IMPORTED_MODULE_2__/* .MAXIMAL_NUMBER_OF_ITERATIONS */ .$Q.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
862
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
867
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
863
868
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
864
869
|
* @param value - Number to normalize.
|
|
865
870
|
* @param dialable - Indicates whether the result should be dialed or
|
|
@@ -738,7 +738,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
738
738
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
739
739
|
* html tags via "['<', '>']" (the default).
|
|
740
740
|
* @returns Start and end index of matching range.
|
|
741
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
741
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
742
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
743
|
+
whitespace), so the reported match index aligns with the real
|
|
744
|
+
character.
|
|
745
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
742
746
|
* Fixes known encoding problems in given data.
|
|
743
747
|
* @param data - To process.
|
|
744
748
|
* @returns Processed data.
|
|
@@ -782,8 +786,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
782
786
|
* @returns The formatted string.
|
|
783
787
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
784
788
|
* Wraps given mark strings in a given target with a given marker.
|
|
785
|
-
* @param target - String to search
|
|
786
|
-
* @param
|
|
789
|
+
* @param target - String to search in.
|
|
790
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
791
|
+
* search for.
|
|
787
792
|
* @param givenOptions - Defines highlighting behavior.
|
|
788
793
|
* @param givenOptions.marker - HTML template string to mark.
|
|
789
794
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -791,11 +796,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
791
796
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
792
797
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
793
798
|
* @returns Processed result.
|
|
794
|
-
*/var mark=function mark(target,
|
|
799
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
795
800
|
Search for matches as long there is enough target text remaining to
|
|
796
801
|
walk through.
|
|
797
802
|
*/for(var iteration=0;iteration<MAXIMAL_NUMBER_OF_ITERATIONS.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
798
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
803
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
799
804
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
800
805
|
* @param value - Number to normalize.
|
|
801
806
|
* @param dialable - Indicates whether the result should be dialed or
|
package/dist/compatible/scope.js
CHANGED
|
@@ -780,7 +780,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
780
780
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
781
781
|
* html tags via "['<', '>']" (the default).
|
|
782
782
|
* @returns Start and end index of matching range.
|
|
783
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
783
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
784
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
785
|
+
whitespace), so the reported match index aligns with the real
|
|
786
|
+
character.
|
|
787
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
784
788
|
* Fixes known encoding problems in given data.
|
|
785
789
|
* @param data - To process.
|
|
786
790
|
* @returns Processed data.
|
|
@@ -824,8 +828,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
824
828
|
* @returns The formatted string.
|
|
825
829
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
826
830
|
* Wraps given mark strings in a given target with a given marker.
|
|
827
|
-
* @param target - String to search
|
|
828
|
-
* @param
|
|
831
|
+
* @param target - String to search in.
|
|
832
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
833
|
+
* search for.
|
|
829
834
|
* @param givenOptions - Defines highlighting behavior.
|
|
830
835
|
* @param givenOptions.marker - HTML template string to mark.
|
|
831
836
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -833,11 +838,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
833
838
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
834
839
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
835
840
|
* @returns Processed result.
|
|
836
|
-
*/var mark=function mark(target,
|
|
841
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
837
842
|
Search for matches as long there is enough target text remaining to
|
|
838
843
|
walk through.
|
|
839
844
|
*/for(var iteration=0;iteration<_context_js__WEBPACK_IMPORTED_MODULE_2__/* .MAXIMAL_NUMBER_OF_ITERATIONS */ .$Q.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
840
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
845
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
841
846
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
842
847
|
* @param value - Number to normalize.
|
|
843
848
|
* @param dialable - Indicates whether the result should be dialed or
|
|
@@ -756,7 +756,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
756
756
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
757
757
|
* html tags via "['<', '>']" (the default).
|
|
758
758
|
* @returns Start and end index of matching range.
|
|
759
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
759
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
760
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
761
|
+
whitespace), so the reported match index aligns with the real
|
|
762
|
+
character.
|
|
763
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
760
764
|
* Fixes known encoding problems in given data.
|
|
761
765
|
* @param data - To process.
|
|
762
766
|
* @returns Processed data.
|
|
@@ -800,8 +804,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
800
804
|
* @returns The formatted string.
|
|
801
805
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
802
806
|
* Wraps given mark strings in a given target with a given marker.
|
|
803
|
-
* @param target - String to search
|
|
804
|
-
* @param
|
|
807
|
+
* @param target - String to search in.
|
|
808
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
809
|
+
* search for.
|
|
805
810
|
* @param givenOptions - Defines highlighting behavior.
|
|
806
811
|
* @param givenOptions.marker - HTML template string to mark.
|
|
807
812
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -809,11 +814,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
809
814
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
810
815
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
811
816
|
* @returns Processed result.
|
|
812
|
-
*/var mark=function mark(target,
|
|
817
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
813
818
|
Search for matches as long there is enough target text remaining to
|
|
814
819
|
walk through.
|
|
815
820
|
*/for(var iteration=0;iteration<_context_js__WEBPACK_IMPORTED_MODULE_2__/* .MAXIMAL_NUMBER_OF_ITERATIONS */ .$Q.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
816
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
821
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
817
822
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
818
823
|
* @param value - Number to normalize.
|
|
819
824
|
* @param dialable - Indicates whether the result should be dialed or
|
package/dist/datetime.js
CHANGED
|
@@ -725,7 +725,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
725
725
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
726
726
|
* html tags via "['<', '>']" (the default).
|
|
727
727
|
* @returns Start and end index of matching range.
|
|
728
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
728
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
729
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
730
|
+
whitespace), so the reported match index aligns with the real
|
|
731
|
+
character.
|
|
732
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
729
733
|
* Fixes known encoding problems in given data.
|
|
730
734
|
* @param data - To process.
|
|
731
735
|
* @returns Processed data.
|
|
@@ -769,8 +773,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
769
773
|
* @returns The formatted string.
|
|
770
774
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
771
775
|
* Wraps given mark strings in a given target with a given marker.
|
|
772
|
-
* @param target - String to search
|
|
773
|
-
* @param
|
|
776
|
+
* @param target - String to search in.
|
|
777
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
778
|
+
* search for.
|
|
774
779
|
* @param givenOptions - Defines highlighting behavior.
|
|
775
780
|
* @param givenOptions.marker - HTML template string to mark.
|
|
776
781
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -778,11 +783,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
778
783
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
779
784
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
780
785
|
* @returns Processed result.
|
|
781
|
-
*/var mark=function mark(target,
|
|
786
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
782
787
|
Search for matches as long there is enough target text remaining to
|
|
783
788
|
walk through.
|
|
784
789
|
*/for(var iteration=0;iteration<MAXIMAL_NUMBER_OF_ITERATIONS.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
785
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
790
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
786
791
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
787
792
|
* @param value - Number to normalize.
|
|
788
793
|
* @param dialable - Indicates whether the result should be dialed or
|
|
@@ -731,7 +731,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
731
731
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
732
732
|
* html tags via "['<', '>']" (the default).
|
|
733
733
|
* @returns Start and end index of matching range.
|
|
734
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
734
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
735
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
736
|
+
whitespace), so the reported match index aligns with the real
|
|
737
|
+
character.
|
|
738
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
735
739
|
* Fixes known encoding problems in given data.
|
|
736
740
|
* @param data - To process.
|
|
737
741
|
* @returns Processed data.
|
|
@@ -775,8 +779,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
775
779
|
* @returns The formatted string.
|
|
776
780
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
777
781
|
* Wraps given mark strings in a given target with a given marker.
|
|
778
|
-
* @param target - String to search
|
|
779
|
-
* @param
|
|
782
|
+
* @param target - String to search in.
|
|
783
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
784
|
+
* search for.
|
|
780
785
|
* @param givenOptions - Defines highlighting behavior.
|
|
781
786
|
* @param givenOptions.marker - HTML template string to mark.
|
|
782
787
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -784,11 +789,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
784
789
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
785
790
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
786
791
|
* @returns Processed result.
|
|
787
|
-
*/var mark=function mark(target,
|
|
792
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
788
793
|
Search for matches as long there is enough target text remaining to
|
|
789
794
|
walk through.
|
|
790
795
|
*/for(var iteration=0;iteration<MAXIMAL_NUMBER_OF_ITERATIONS.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
791
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
796
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
792
797
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
793
798
|
* @param value - Number to normalize.
|
|
794
799
|
* @param dialable - Indicates whether the result should be dialed or
|
package/dist/expression/index.js
CHANGED
|
@@ -714,7 +714,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
714
714
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
715
715
|
* html tags via "['<', '>']" (the default).
|
|
716
716
|
* @returns Start and end index of matching range.
|
|
717
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
717
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
718
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
719
|
+
whitespace), so the reported match index aligns with the real
|
|
720
|
+
character.
|
|
721
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
718
722
|
* Fixes known encoding problems in given data.
|
|
719
723
|
* @param data - To process.
|
|
720
724
|
* @returns Processed data.
|
|
@@ -758,8 +762,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
758
762
|
* @returns The formatted string.
|
|
759
763
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
760
764
|
* Wraps given mark strings in a given target with a given marker.
|
|
761
|
-
* @param target - String to search
|
|
762
|
-
* @param
|
|
765
|
+
* @param target - String to search in.
|
|
766
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
767
|
+
* search for.
|
|
763
768
|
* @param givenOptions - Defines highlighting behavior.
|
|
764
769
|
* @param givenOptions.marker - HTML template string to mark.
|
|
765
770
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -767,11 +772,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
767
772
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
768
773
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
769
774
|
* @returns Processed result.
|
|
770
|
-
*/var mark=function mark(target,
|
|
775
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
771
776
|
Search for matches as long there is enough target text remaining to
|
|
772
777
|
walk through.
|
|
773
778
|
*/for(var iteration=0;iteration<MAXIMAL_NUMBER_OF_ITERATIONS.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
774
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
779
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
775
780
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
776
781
|
* @param value - Number to normalize.
|
|
777
782
|
* @param dialable - Indicates whether the result should be dialed or
|
package/dist/index.js
CHANGED
|
@@ -802,7 +802,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
802
802
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
803
803
|
* html tags via "['<', '>']" (the default).
|
|
804
804
|
* @returns Start and end index of matching range.
|
|
805
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
805
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
806
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
807
|
+
whitespace), so the reported match index aligns with the real
|
|
808
|
+
character.
|
|
809
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
806
810
|
* Fixes known encoding problems in given data.
|
|
807
811
|
* @param data - To process.
|
|
808
812
|
* @returns Processed data.
|
|
@@ -846,8 +850,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
846
850
|
* @returns The formatted string.
|
|
847
851
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
848
852
|
* Wraps given mark strings in a given target with a given marker.
|
|
849
|
-
* @param target - String to search
|
|
850
|
-
* @param
|
|
853
|
+
* @param target - String to search in.
|
|
854
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
855
|
+
* search for.
|
|
851
856
|
* @param givenOptions - Defines highlighting behavior.
|
|
852
857
|
* @param givenOptions.marker - HTML template string to mark.
|
|
853
858
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -855,11 +860,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
855
860
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
856
861
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
857
862
|
* @returns Processed result.
|
|
858
|
-
*/var mark=function mark(target,
|
|
863
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
859
864
|
Search for matches as long there is enough target text remaining to
|
|
860
865
|
walk through.
|
|
861
866
|
*/for(var iteration=0;iteration<_context_js__WEBPACK_IMPORTED_MODULE_2__/* .MAXIMAL_NUMBER_OF_ITERATIONS */ .$Q.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
862
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
867
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
863
868
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
864
869
|
* @param value - Number to normalize.
|
|
865
870
|
* @param dialable - Indicates whether the result should be dialed or
|
package/dist/object.js
CHANGED
|
@@ -738,7 +738,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
738
738
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
739
739
|
* html tags via "['<', '>']" (the default).
|
|
740
740
|
* @returns Start and end index of matching range.
|
|
741
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
741
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
742
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
743
|
+
whitespace), so the reported match index aligns with the real
|
|
744
|
+
character.
|
|
745
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
742
746
|
* Fixes known encoding problems in given data.
|
|
743
747
|
* @param data - To process.
|
|
744
748
|
* @returns Processed data.
|
|
@@ -782,8 +786,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
782
786
|
* @returns The formatted string.
|
|
783
787
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
784
788
|
* Wraps given mark strings in a given target with a given marker.
|
|
785
|
-
* @param target - String to search
|
|
786
|
-
* @param
|
|
789
|
+
* @param target - String to search in.
|
|
790
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
791
|
+
* search for.
|
|
787
792
|
* @param givenOptions - Defines highlighting behavior.
|
|
788
793
|
* @param givenOptions.marker - HTML template string to mark.
|
|
789
794
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -791,11 +796,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
791
796
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
792
797
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
793
798
|
* @returns Processed result.
|
|
794
|
-
*/var mark=function mark(target,
|
|
799
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
795
800
|
Search for matches as long there is enough target text remaining to
|
|
796
801
|
walk through.
|
|
797
802
|
*/for(var iteration=0;iteration<MAXIMAL_NUMBER_OF_ITERATIONS.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
798
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
803
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
799
804
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
800
805
|
* @param value - Number to normalize.
|
|
801
806
|
* @param dialable - Indicates whether the result should be dialed or
|
package/dist/scope.js
CHANGED
|
@@ -780,7 +780,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
780
780
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
781
781
|
* html tags via "['<', '>']" (the default).
|
|
782
782
|
* @returns Start and end index of matching range.
|
|
783
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
783
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
784
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
785
|
+
whitespace), so the reported match index aligns with the real
|
|
786
|
+
character.
|
|
787
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
784
788
|
* Fixes known encoding problems in given data.
|
|
785
789
|
* @param data - To process.
|
|
786
790
|
* @returns Processed data.
|
|
@@ -824,8 +828,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
824
828
|
* @returns The formatted string.
|
|
825
829
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
826
830
|
* Wraps given mark strings in a given target with a given marker.
|
|
827
|
-
* @param target - String to search
|
|
828
|
-
* @param
|
|
831
|
+
* @param target - String to search in.
|
|
832
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
833
|
+
* search for.
|
|
829
834
|
* @param givenOptions - Defines highlighting behavior.
|
|
830
835
|
* @param givenOptions.marker - HTML template string to mark.
|
|
831
836
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -833,11 +838,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
833
838
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
834
839
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
835
840
|
* @returns Processed result.
|
|
836
|
-
*/var mark=function mark(target,
|
|
841
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
837
842
|
Search for matches as long there is enough target text remaining to
|
|
838
843
|
walk through.
|
|
839
844
|
*/for(var iteration=0;iteration<_context_js__WEBPACK_IMPORTED_MODULE_2__/* .MAXIMAL_NUMBER_OF_ITERATIONS */ .$Q.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
840
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
845
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
841
846
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
842
847
|
* @param value - Number to normalize.
|
|
843
848
|
* @param dialable - Indicates whether the result should be dialed or
|
package/dist/string.d.ts
CHANGED
|
@@ -217,7 +217,7 @@ export declare const evaluateOrThrowError: <Result = string, Scope extends objec
|
|
|
217
217
|
* html tags via "['<', '>']" (the default).
|
|
218
218
|
* @returns Start and end index of matching range.
|
|
219
219
|
*/
|
|
220
|
-
export declare const findNormalizedMatchRange: (target:
|
|
220
|
+
export declare const findNormalizedMatchRange: (target: string, query: RegExp | string, normalizer?: <T extends RegExp | string>(value: T) => T, skipTagDelimitedParts?: null | [string, string]) => Array<number> | null;
|
|
221
221
|
/**
|
|
222
222
|
* Fixes known encoding problems in given data.
|
|
223
223
|
* @param data - To process.
|
|
@@ -255,8 +255,9 @@ export declare const maskForRegularExpression: (value: string) => string;
|
|
|
255
255
|
export declare const lowerCase: (string: string) => string;
|
|
256
256
|
/**
|
|
257
257
|
* Wraps given mark strings in a given target with a given marker.
|
|
258
|
-
* @param target - String to search
|
|
259
|
-
* @param
|
|
258
|
+
* @param target - String to search in.
|
|
259
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
260
|
+
* search for.
|
|
260
261
|
* @param givenOptions - Defines highlighting behavior.
|
|
261
262
|
* @param givenOptions.marker - HTML template string to mark.
|
|
262
263
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -265,7 +266,7 @@ export declare const lowerCase: (string: string) => string;
|
|
|
265
266
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
266
267
|
* @returns Processed result.
|
|
267
268
|
*/
|
|
268
|
-
export declare const mark: (target:
|
|
269
|
+
export declare const mark: (target: RegExp | string, givenSearchWords?: Array<RegExp | string> | RegExp | string, givenOptions?: Partial<StringMarkOptions>) => unknown;
|
|
269
270
|
/**
|
|
270
271
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
271
272
|
* @param value - Number to normalize.
|
package/dist/string.js
CHANGED
|
@@ -756,7 +756,11 @@ var _compile=compile(expression,options),error=_compile.error,originalScopeNames
|
|
|
756
756
|
* @param skipTagDelimitedParts - Indicates whether to, for example, ignore
|
|
757
757
|
* html tags via "['<', '>']" (the default).
|
|
758
758
|
* @returns Start and end index of matching range.
|
|
759
|
-
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return
|
|
759
|
+
*/var findNormalizedMatchRange=function findNormalizedMatchRange(target,query,normalizer,skipTagDelimitedParts){if(normalizer===void 0){normalizer=function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value}}if(skipTagDelimitedParts===void 0){skipTagDelimitedParts=["<",">"]}var normalizedQuery=normalizer(query);var stringNormalizedQuery;if(typeof normalizedQuery==="string")stringNormalizedQuery=normalizedQuery;else{var match=target.match(normalizedQuery);stringNormalizedQuery=match?match[0]:""}if(!stringNormalizedQuery)return null;var normalizedTarget=normalizer(target);if(!normalizedTarget)return null;var stringTarget=typeof target==="string"?target:normalizedTarget;var inTag=false;for(var index=0;index<stringTarget.length;index+=1){if(inTag){if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[1])inTag=false;continue}if(Array.isArray(skipTagDelimitedParts)&&stringTarget.charAt(index)===skipTagDelimitedParts[0]){inTag=true;continue}/*
|
|
760
|
+
Skip positions the normalizer strips away (e.g. leading
|
|
761
|
+
whitespace), so the reported match index aligns with the real
|
|
762
|
+
character.
|
|
763
|
+
*/if(!normalizer(stringTarget.charAt(index)))continue;if(normalizer(stringTarget.substring(index)).startsWith(stringNormalizedQuery)){if(stringNormalizedQuery.length===1)return[index,index+1];for(var subIndex=stringTarget.length;subIndex>index;subIndex-=1)if(!normalizer(stringTarget.substring(index,subIndex)).startsWith(stringNormalizedQuery))return[index,subIndex+1]}}return null};/**
|
|
760
764
|
* Fixes known encoding problems in given data.
|
|
761
765
|
* @param data - To process.
|
|
762
766
|
* @returns Processed data.
|
|
@@ -800,8 +804,9 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
800
804
|
* @returns The formatted string.
|
|
801
805
|
*/var lowerCase=function lowerCase(string){return string.charAt(0).toLowerCase()+string.substring(1)};/**
|
|
802
806
|
* Wraps given mark strings in a given target with a given marker.
|
|
803
|
-
* @param target - String to search
|
|
804
|
-
* @param
|
|
807
|
+
* @param target - String to search in.
|
|
808
|
+
* @param givenSearchWords - String or regular expression or array of those to
|
|
809
|
+
* search for.
|
|
805
810
|
* @param givenOptions - Defines highlighting behavior.
|
|
806
811
|
* @param givenOptions.marker - HTML template string to mark.
|
|
807
812
|
* @param givenOptions.normalizer - Pure normalization function to use before
|
|
@@ -809,11 +814,11 @@ distanceMatrix[firstIndex-1][secondIndex-1]+indicator)}return distanceMatrix[sec
|
|
|
809
814
|
* @param givenOptions.skipTagDelimitedParts - Indicates whether to, for
|
|
810
815
|
* example, ignore html tags via "['<', '>']" (the default).
|
|
811
816
|
* @returns Processed result.
|
|
812
|
-
*/var mark=function mark(target,
|
|
817
|
+
*/var mark=function mark(target,givenSearchWords,givenOptions){if(givenOptions===void 0){givenOptions={}}if(typeof target==="string"&&(Array.isArray(givenSearchWords)&&givenSearchWords.length||givenSearchWords instanceof RegExp||typeof givenSearchWords==="string"&&givenSearchWords.length)){var options=_objectSpread({marker:"<span class=\"tools-mark\">{1}</span>",normalizer:function normalizer(value){return typeof value==="string"?value.trim().toLowerCase():value},skipTagDelimitedParts:["<",">"]},givenOptions);target=target.trim();var markedTarget=[];var searchWords=[].concat(givenSearchWords);var index=0;var _iterator6=_createForOfIteratorHelper(searchWords),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _word=_step6.value;searchWords[index]=options.normalizer(_word);index+=1}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}var restTarget=target;var offset=0;/*
|
|
813
818
|
Search for matches as long there is enough target text remaining to
|
|
814
819
|
walk through.
|
|
815
820
|
*/for(var iteration=0;iteration<_context_js__WEBPACK_IMPORTED_MODULE_2__/* .MAXIMAL_NUMBER_OF_ITERATIONS */ .$Q.value;iteration++){var nearestRange=null;var currentRange=void 0;// Find the nearest next matching word.
|
|
816
|
-
var _iterator7=_createForOfIteratorHelper(
|
|
821
|
+
var _iterator7=_createForOfIteratorHelper(searchWords),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var word=_step7.value;currentRange=findNormalizedMatchRange(restTarget,word,options.normalizer,options.skipTagDelimitedParts);if(currentRange&&(!nearestRange||currentRange[0]<nearestRange[0]))nearestRange=currentRange}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(nearestRange){if(nearestRange[0]>0)markedTarget.push(target.substring(offset,offset+nearestRange[0]));markedTarget.push(typeof options.marker==="string"?format(options.marker,target.substring(offset+nearestRange[0],offset+nearestRange[1])):options.marker(target.substring(offset+nearestRange[0],offset+nearestRange[1]),markedTarget));offset+=nearestRange[1];restTarget=target.substring(offset)}else{if(restTarget.length)markedTarget.push(restTarget);break}}return typeof options.marker==="string"?markedTarget.join(""):markedTarget}return target};/**
|
|
817
822
|
* Normalizes a given phone number for automatic dialing or comparison.
|
|
818
823
|
* @param value - Number to normalize.
|
|
819
824
|
* @param dialable - Indicates whether the result should be dialed or
|
package/dist/type.d.ts
CHANGED
|
@@ -218,7 +218,7 @@ export type EvaluationResult<Type = string> = PositiveEvaluationResult<Type> | N
|
|
|
218
218
|
export type LockCallbackFunction<Type> = (description?: string) => Promise<Type> | Type;
|
|
219
219
|
export interface StringMarkOptions {
|
|
220
220
|
marker: ((foundWord: string, markedTarget: Array<unknown>) => unknown) | string;
|
|
221
|
-
normalizer: (value:
|
|
221
|
+
normalizer: <T extends RegExp | string>(value: T) => T;
|
|
222
222
|
skipTagDelimitedParts: null | [string, string];
|
|
223
223
|
}
|
|
224
224
|
export interface InterruptableScrollToOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clientnode",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1505",
|
|
4
4
|
"description": "Handy utilities for any JavaScript environments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"client",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"clientnode": "workspace:.",
|
|
94
94
|
"eslint": "^10.9.1",
|
|
95
95
|
"eslint-config-google": "^0.14.0",
|
|
96
|
-
"eslint-plugin-jsdoc": "^64.3.
|
|
96
|
+
"eslint-plugin-jsdoc": "^64.3.5",
|
|
97
97
|
"favicons-webpack-plugin": "^6.0.1",
|
|
98
98
|
"image-minimizer-webpack-plugin": "^5.0.0",
|
|
99
99
|
"jest": "30.5.1",
|