From 90b76a47fbc9e5c5c7c773149e93758f477d48cd Mon Sep 17 00:00:00 2001 From: meikidd Date: Fri, 9 Aug 2019 21:38:46 +0800 Subject: [PATCH] add es module usage example --- readme.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index 80d68cb..d32de7f 100644 --- a/readme.md +++ b/readme.md @@ -22,23 +22,30 @@ npm install iso-639-1 ### Node.js +```javascript +const ISO6391 = require('iso-639-1'); +console.log(ISO6391.getName('en')); // 'English' ``` -const ISO6391 = require('iso-639-1') -console.log(ISO6391.getName('en')) // 'English' + +### ES Module + +```javascript +import ISO6391 from 'iso-639-1'; +console.log(ISO6391.getName('en')); // 'English' ``` ### Browsers HTML -``` +```html ``` Visit global variable ISO6391 in js -``` -console.log(ISO6391.getName('en')) // 'English' +```javascript +console.log(ISO6391.getName('en')); // 'English' ``` ## Methods @@ -89,7 +96,7 @@ Check whether the given code is in the list of [ISO-639-1](https://en.wikipedia. Get the array of the language objects by the given codes -## Usage +## Example ``` const ISO6391 = require('iso-639-1')