-
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add an example of importing Ohm as an ES module.
Testing #185
- Loading branch information
Showing
5 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// An example showing how to use Ohm as an ECMAScript module in Node v12+. | ||
|
||
import ohm from 'ohm-js'; | ||
|
||
const g = ohm.grammar('G { start = }'); | ||
g.match(""); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "es-module", | ||
"version": "0.0.1", | ||
"private": true, | ||
"dependencies": { | ||
"ohm-js": "^15.0.1" | ||
}, | ||
"scripts": { | ||
"test": "node --experimental-modules main.mjs" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"rollup": "^2.26.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,8 @@ | |
"license": "MIT", | ||
"devDependencies": { | ||
"mocha": "^8.1.1" | ||
}, | ||
"dependencies": { | ||
"ohm-js": "^15.0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters