Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
Using es6 import / export instead of commonjs require (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinvdvleuten authored Nov 22, 2017
1 parent 3c27e08 commit d108b29
Show file tree
Hide file tree
Showing 5 changed files with 511 additions and 14 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var merge = require('deepmerge');
var shvl = require('shvl');
import merge from 'deepmerge';
import shvl from 'shvl';

module.exports = function(options, storage, key) {
export default function(options, storage, key) {
options = options || {};
storage = options.storage || (window && window.localStorage);
key = options.key || 'vuex';
Expand Down Expand Up @@ -53,7 +53,7 @@ module.exports = function(options, storage, key) {
}

return function(store) {
var savedState = shvl.get(options, 'getState', getState)(key, storage);
const savedState = shvl.get(options, 'getState', getState)(key, storage);

if (typeof savedState === 'object' && savedState !== null) {
store.replaceState(merge(store.state, savedState, {
Expand Down
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,18 @@
"threshold": "1.1kb"
}
],
"babel": {
"presets": [
"env"
]
},
"dependencies": {
"deepmerge": "^2.0.1",
"shvl": "^1.1.1"
},
"devDependencies": {
"babel-jest": "^21.2.0",
"babel-preset-env": "^1.6.1",
"bundlesize": "^0.15.3",
"dom-storage": "^2.0.2",
"eslint": "^4.11.0",
Expand All @@ -59,6 +66,7 @@
"prettier": "^1.8.2",
"rimraf": "^2.6.2",
"rollup": "^0.51.8",
"rollup-plugin-buble": "^0.18.0",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-node-resolve": "^3.0.0",
"uglify-js": "^2.8.29",
Expand Down
2 changes: 2 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'fs';
import buble from 'rollup-plugin-buble';
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';

Expand All @@ -9,6 +10,7 @@ export default {
useStrict: false,
sourcemap: true,
plugins: [
buble(),
resolve({
jsnext: true,
main: true
Expand Down
8 changes: 4 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Vue = require('vue');
const Vuex = require('vuex');
const Storage = require('dom-storage');
const createPersistedState = require('./index');
import Vue from 'vue';
import Vuex from 'vuex';
import Storage from 'dom-storage';
import createPersistedState from './index';

Vue.use(Vuex);

Expand Down
Loading

0 comments on commit d108b29

Please sign in to comment.