Skip to content

Commit 9831cca

Browse files
committed
use eslint-config-cycle
1 parent c605b6f commit 9831cca

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

.eslintrc

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"extends": "airbnb/base"
2+
"extends": "eslint-config-cycle",
3+
"env": {
4+
"browser": true
5+
}
36
}

index.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import doAction from './lib/doAction';
2-
import responseCollection from './lib/responseCollection';
1+
import doAction from './lib/doAction'
2+
import responseCollection from './lib/responseCollection'
33

44
export default function storageDriver(request$) {
55
// Execute writing actions.
6-
request$.subscribe((req) => doAction(req.target, req.action, req.key, req.value));
6+
request$.subscribe((req) => {
7+
doAction(req.target, req.action, req.key, req.value)
8+
})
79

810
// Return reading functions.
9-
return responseCollection;
11+
return responseCollection
1012
}

lib/doAction.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
*/
1010
export default function doAction(target = 'local', action = 'setItem', key = undefined, value = undefined) { // eslint-disable-line
1111
// Store the third and the fourth parameter in a new array, if defined.
12-
const storageArgs = Array.prototype.slice.call(arguments, 2);
12+
const storageArgs = Array.prototype.slice.call(arguments, 2)
1313
// Determine the storage target.
14-
const storage = (target === 'local') ? localStorage : sessionStorage;
14+
const storage = target === `local` ? localStorage : sessionStorage
1515

1616
// Execute the storage action and pass arguments if they were defined.
17-
storage[action](...storageArgs);
17+
storage[action](...storageArgs)
1818
}

lib/responseCollection.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
import { Rx } from '@cycle/core';
1+
import {Rx} from '@cycle/core'
22

33
export default {
44
// For localStorage.
55
local: {
66
key(n) {
77
// Function returning Observable of the nth key.
8-
return Rx.Observable.just(localStorage.key(n));
8+
return Rx.Observable.just(localStorage.key(n))
99
},
1010
// Function returning Observable of values.
1111
getItem(key) {
12-
return Rx.Observable.just(localStorage.getItem(key));
12+
return Rx.Observable.just(localStorage.getItem(key))
1313
},
1414
},
1515
// For sessionStorage.
1616
session: {
1717
// Function returning Observable of the nth key.
1818
key(n) {
19-
return Rx.Observable.just(sessionStorage.key(n));
19+
return Rx.Observable.just(sessionStorage.key(n))
2020
},
2121
// Function returning Observable of values.
2222
getItem(key) {
23-
return Rx.Observable.just(sessionStorage.getItem(key));
23+
return Rx.Observable.just(sessionStorage.getItem(key))
2424
},
2525
},
26-
};
26+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"babel-eslint": "^4.1.4",
1515
"babel-preset-es2015": "^6.1.2",
1616
"eslint": "^1.9.0",
17-
"eslint-config-airbnb": "^1.0.0",
17+
"eslint-config-cycle": "^3.0.0",
1818
"esnow": "^2.0.1",
1919
"rx": "^4.0.6"
2020
},

0 commit comments

Comments
 (0)