Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

Commit f93790f

Browse files
Merge pull request #494 from zixia/master
add default export
2 parents 091cd95 + 586993b commit f93790f

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ LevelUP
2020
* <a href="#basic">Basic usage</a>
2121
* <a href="#api">API</a>
2222
* <a href="#promises">Promise Support</a>
23+
* <a href="#import">Import with Type Definitions</a>
2324
* <a href="#events">Events</a>
2425
* <a href="#extending">Extending LevelUP</a>
2526
* <a href="#multiproc">Multi-process access</a>
@@ -452,6 +453,26 @@ const main = async () {
452453

453454
--------------------------------------------------------
454455

456+
<a name="import"></a>
457+
ES6 Import
458+
----------
459+
460+
We have two ways to import(require) the levelup module in the code.
461+
462+
### 1. By using `require`
463+
464+
```js
465+
var levelup = require('levelup')
466+
```
467+
468+
### 2. By using ES6 `import`
469+
470+
```js
471+
import levelup from 'levelup'
472+
```
473+
474+
--------------------------------------------------------
475+
455476
<a name="events"></a>
456477
Events
457478
------

lib/levelup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,4 +291,4 @@ function maybeError (db, callback) {
291291
}
292292

293293
LevelUP.errors = errors
294-
module.exports = LevelUP
294+
module.exports = LevelUP.default = LevelUP

0 commit comments

Comments
 (0)