Skip to content

Commit

Permalink
update readme.md. add Usage section.
Browse files Browse the repository at this point in the history
  • Loading branch information
meikidd committed Dec 8, 2017
1 parent b2a1366 commit 53191af
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,29 @@ Simple interface for [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1
npm install iso-639-1
```

## Usage

### Node.js

```
const ISO6391 = require('iso-639-1')
console.log(ISO6391.getName('en')) // 'English'
```

### Browsers

HTML

```
<script type="text/javascript" src="./node_modules/iso-639-1/build/index.js"></script>
```

Visit global variable ISO6391 in js

```
console.log(ISO6391.getName('en')) // 'English'
```

## Methods

### getName(code)
Expand Down Expand Up @@ -69,7 +92,7 @@ Get the array of the language objects by the given codes
## Usage

```
var ISO6391 = require('./iso-639-1')
const ISO6391 = require('iso-639-1')
console.log(ISO6391.getName('zh')) // 'Chinese'
console.log(ISO6391.getNativeName('zh')) // '中文'
Expand Down

0 comments on commit 53191af

Please sign in to comment.