fix(core): update

This commit is contained in:
2019-05-10 17:03:07 +02:00
parent 7109b666f5
commit 0689e33ae6
5 changed files with 226 additions and 107 deletions

View File

@ -21,12 +21,11 @@ export class KeyValueStore {
bufferMax: 2,
execDelay: 500,
taskFunction: async () => {
this.dataObject = plugins.smartlodash.merge(
{},
plugins.smartfile.fs.toObjectSync(this.filePath),
this.dataObject
);
for (let key in this.deletedObject) {
this.dataObject = {
...plugins.smartfile.fs.toObjectSync(this.filePath),
...this.dataObject
};
for (const key of Object.keys(this.deletedObject)) {
delete this.dataObject[key];
}
this.deletedObject = {};
@ -79,15 +78,15 @@ export class KeyValueStore {
/**
* writes all keyValue pairs in the object argument
*/
async writeAll(keyValueObject) {
plugins.smartlodash.merge(this.dataObject, keyValueObject);
public async writeAll(keyValueObject) {
this.dataObject = {...this.dataObject, ...keyValueObject};
this.syncTask.trigger();
}
/**
* wipes a key value store from disk
*/
async wipe() {
public async wipe() {
for (let key in this.dataObject) {
this.deletedObject[key] = this.dataObject[key];
}

View File

@ -34,7 +34,10 @@ export class Npmextra {
} else {
npmextraToolOptions = {};
}
let mergedOptions = plugins.smartlodash.merge({}, defaultOptionsArg, npmextraToolOptions);
let mergedOptions = {
...defaultOptionsArg,
...npmextraToolOptions
};
return mergedOptions;
}

View File

@ -1,9 +1,8 @@
import * as beautylog from '@pushrocks/smartlog';
import * as path from 'path';
import * as smartfile from '@pushrocks/smartfile';
import smartlodash from 'smartlodash';
import * as smartpath from '@pushrocks/smartpath';
import * as smartpromise from '@pushrocks/smartpromise';
import * as taskbuffer from '@pushrocks/taskbuffer';
export { beautylog, path, smartfile, smartpath, smartpromise, smartlodash, taskbuffer };
export { beautylog, path, smartfile, smartpath, smartpromise, taskbuffer };