git ssb

0+

cel-desktop / ssb-pkg



Tree: 1eb144e388da5f1a3466703f56ac4ab591d700fc

Files: 1eb144e388da5f1a3466703f56ac4ab591d700fc / test / test-79-npm / level / level.js

751 bytesRaw
1'use strict';
2
3var level = require('level');
4var db = level('dbname');
5var rimraf = require('../../../node_modules/rimraf');
6
7(function (cb) {
8 db.open(function (error1) {
9 if (error1) return cb(error1);
10
11 db.put('dave@gmail.com', JSON.stringify({
12 _id: 'dave@gmail.com',
13 name: 'David',
14 age: 68
15 }), function (error2) {
16 if (error2) return cb(error2);
17 db.get('dave@gmail.com', function (error3, data) {
18 if (error3) return cb(error3);
19 data = JSON.parse(data.toString());
20 if (data.age === 68) {
21 console.log('ok');
22 return cb();
23 }
24 });
25 });
26 });
27}(function (error) {
28 if (error) throw error;
29 db.close(function () {
30 rimraf.sync('dbname');
31 });
32}));
33

Built with git-ssb-web