Skip to content

Commit

Permalink
Merge pull request #1 from johnwquarles/import_module_default_when_us…
Browse files Browse the repository at this point in the history
…ing_require

Import module default instead of module itself when using "require"
  • Loading branch information
johnwquarles committed Sep 30, 2017
2 parents a99cc0b + da90349 commit bbb2210
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,23 @@ https://yarnpkg.com/lang/en/docs/install/

Import & pass `mirrarray` an array full of keys.


es6 module syntax:
```javascript
import mirrarray from 'mirrarray';

const keymirror = mirrarray(['this', 'that', 'another']);
```

or commonjs:
```javascript
var mirrarray = require("mirrarray");

var keymirror = mirrarray(['this', 'that', 'another']);
```

_Please note_ that the commonjs example above is current to version 2.0.0. Earlier versions would have required you to enter `require("mirrarray").default`, but this was undocumented. Usage via es6 module syntax has not been changed.

Now `keymirror` is an object containing key/value pairs for each element in the input array.

```javascript
Expand Down
2 changes: 1 addition & 1 deletion dist/mirrarray.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mirrarray",
"version": "1.0.0",
"version": "2.0.0",
"description": "Very simple package for creating a keymirror object from an array of strings",
"main": "dist/mirrarray.js",
"unpkg": "dist/mirrarray.js",
Expand Down
1 change: 1 addition & 0 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default {
path: path.resolve(__dirname, './dist'),
filename: `${outputName}.js`,
library: outputName,
libraryExport: 'default',
libraryTarget: 'umd',
},
plugins: [
Expand Down

0 comments on commit bbb2210

Please sign in to comment.