1 | /* eslint-disable no-underscore-dangle */
|
2 |
|
3 | /* eslint-disable func-names */
|
4 | import { parse, stringify } from 'telejson'; // setting up the store, overriding set and get to use telejson
|
5 |
|
6 | export default (function (_) {
|
7 | _.fn('set', function (key, data) {
|
8 | return _.set(this._area, this._in(key), stringify(data, {
|
9 | maxDepth: 50
|
10 | }));
|
11 | });
|
12 |
|
13 | _.fn('get', function (key, alt) {
|
14 | var value = _.get(this._area, this._in(key));
|
15 |
|
16 | return value !== null ? parse(value) : alt || value;
|
17 | });
|
18 | }); |
\ | No newline at end of file |