edge-lexer
Advanced tools
Comparing version 3.1.6 to 3.2.0
@@ -56,2 +56,3 @@ /** | ||
filename: string; | ||
onLine?: (line: string) => string; | ||
}); | ||
@@ -58,0 +59,0 @@ /** |
@@ -380,2 +380,8 @@ "use strict"; | ||
/** | ||
* Pre process line when the onLine listener is defined | ||
*/ | ||
if (typeof this.options.onLine === 'function') { | ||
line = this.options.onLine(line); | ||
} | ||
/** | ||
* There is an open block statement, so feed line to it | ||
@@ -382,0 +388,0 @@ */ |
{ | ||
"name": "edge-lexer", | ||
"version": "3.1.6", | ||
"version": "3.2.0", | ||
"description": "Parses raw markup files to converts them to Edge tokens", | ||
@@ -36,4 +36,4 @@ "main": "build/index.js", | ||
"@adonisjs/mrm-preset": "^2.4.0", | ||
"@adonisjs/require-ts": "^1.0.4", | ||
"@types/node": "^14.14.6", | ||
"@adonisjs/require-ts": "^1.1.0", | ||
"@types/node": "^14.14.7", | ||
"benchmark": "^2.1.4", | ||
@@ -45,3 +45,3 @@ "commitizen": "^4.2.2", | ||
"doctoc": "^1.4.0", | ||
"eslint": "^7.12.1", | ||
"eslint": "^7.13.0", | ||
"eslint-config-prettier": "^6.15.0", | ||
@@ -54,5 +54,5 @@ "eslint-plugin-adonis": "^1.0.15", | ||
"japa-cli": "^1.0.1", | ||
"mrm": "^2.5.8", | ||
"mrm": "^2.5.12", | ||
"np": "^7.0.0", | ||
"npm-audit-html": "^1.4.3", | ||
"npm-audit-html": "^1.5.0", | ||
"prettier": "^2.1.2", | ||
@@ -59,0 +59,0 @@ "typedoc": "^0.19.2", |
@@ -22,2 +22,3 @@ <div align="center"><img src="https://res.cloudinary.com/adonis-js/image/upload/q_100/v1600679850/edge-banner_wao6ex.png" width="600px"></div> | ||
- [Usage](#usage) | ||
- [Pre-processing lines](#pre-processing-lines) | ||
- [Terms used](#terms-used) | ||
@@ -94,2 +95,20 @@ - [Tokens](#tokens) | ||
## Pre-processing lines | ||
You can also pre-process lines before the tokenizer tokenizes them. | ||
```ts | ||
const options = { | ||
filename: 'welcome.edge', | ||
onLine: (line: string) => { | ||
// transform here and return new string value | ||
return line | ||
}, | ||
} | ||
const tokenizer = new Tokenizer(template, {}, options) | ||
``` | ||
--- | ||
## Terms used | ||
@@ -96,0 +115,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63438
1523
503