stringtokenizer
Advanced tools
+11
-9
| var StringTokenizer = function() {}; | ||
| /** | ||
| * Given the provided string template, generates a tokenized object | ||
| * Given the provided string template, generates a tokenized 'pattern' object | ||
| * which contains information about the template to be used in future | ||
@@ -42,10 +42,12 @@ * calls to parse(). | ||
| /** | ||
| * Will attempt to parse the provided string (str) with the | ||
| * tokenized object. In order to obtain a properly constructed | ||
| * tokenized object, a string template must be provided to the tokenize() | ||
| * method. If the tokenized object is capable of parsing the provided string, | ||
| * then an object with all parsed token values will be returned. If it is unable | ||
| * to parse the string (e.g., no match) then undefined will be returned. | ||
| * Will attempt to parse the provided string (str) with the provided | ||
| * tokenized 'pattern' object. In order to obtain a properly constructed | ||
| * tokenized pattern, a string template must be provided to the tokenize() | ||
| * method. | ||
| * | ||
| * For example; If a tokenized object has been constructed from the following | ||
| * If the tokenized object is capable of parsing the provided string, | ||
| * then an object with all parsed token names and values will be returned. | ||
| * If it is unable to parse the string (e.g., no match) then undefined will be returned. | ||
| * | ||
| * For example; If a tokenized pattern has been constructed from the following | ||
| * template; | ||
@@ -55,3 +57,3 @@ * | ||
| * | ||
| * And that tokenized object is provided to this parse() method along with the | ||
| * And that pattern object is provided to this parse() method along with the | ||
| * following string; | ||
@@ -58,0 +60,0 @@ * |
+1
-1
@@ -5,3 +5,3 @@ { | ||
| "description": "JavaScript string parsing micro-module for Nodejs.", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
+8
-1
@@ -6,2 +6,9 @@ Nodejs StringTokenizer | ||
| * To test `npm test` | ||
| This API provides a means of tokenizing and extracting variables | ||
| from strings based off of simple template patterns. | ||
| Ideal for URL (path-info / REST web service endpoint) variable extrapolation. | ||
| Install: `npm install` | ||
| Test: `npm test` |
7044
3.86%158
1.28%13
116.67%