How to use the node-persist.clearSync function in node-persist

To help you get started, we’ve selected a few node-persist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bcongdon / github-label-notify / glnotify-clear.js View on Github external
var storage = require('node-persist')

// Will blow away:
//  - watch_list saved repos
//  - saved ('read') issues
storage.initSync();
storage.clearSync();
github mistval / kotoba / test / command_tests.js View on Github external
const MockConfig = require('./mock_objects/mock_config.js');
const persistence = require('./../core/persistence.js');
const Storage = require('node-persist');

const MsgNoPerms = new MockMessage('channel1', 'user1', 'Username', ['Server Admin'], []);
const MsgIsServerAdmin = new MockMessage('channel1', 'user1', 'Username', ['Server Admin'], ['Server Admin']);
const MsgIsBotAdmin = new MockMessage('channel1', 'bot-admin-id', 'Username');
const MsgIsBotAndServerAdmin = new MockMessage('channel1', 'bot-admin-id', 'Username', ['Server Admin'], ['Server Admin']);
const MsgDM = new MockMessage('channel1', 'bot-admin-id', 'Username');
const config = new MockConfig('Server Admin', ['bot-admin-id']);

if (!persistence.initialized_) {
  persistence.init({dir: './test/persistence'});
}

Storage.clearSync();

const commandDataNoAliases = {
  commandAliases: [],
  action(bot, msg, suffix) { },
};

const commandDataUndefinedAliases = {
  action(bot, msg, suffix) { },
};

const commandDataBlankAlias = {
  commandAliases: ['alias1', ''],
  action(bot, msg, suffix) { },
};

const commandDataNonStringAliases = {
github mistval / kotoba / test / persistence_tests.js View on Github external
const assert = require('assert');
const Storage = require('node-persist');
const persistence = require('./../core/persistence.js');

if (!persistence.initialized_) {
  persistence.init({dir: './test/persistence'});
}

Storage.clearSync();

function createNextEdit(index) {
  persistence.editGlobalData((data) => {
    if (index < 100) {
      createNextEdit(index + 1);
    }

    data[index.toString()] = index;
    return data;
  });
}

describe('Persistence', function() {
  it('Does not allow edits to collide', function(done) {
    createNextEdit(0);
    setTimeout(() => {
github giangvo / alfred-workflow-nodejs / alfredNode.js View on Github external
clear: function() {
            storage.clearSync();
        }
    };