Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

memdown

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memdown - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0

27

memdown.js

@@ -9,5 +9,14 @@ var util = require('util')

function toKey (key) {
return typeof key == 'string' ? key : JSON.stringify(key)
return typeof key == 'string' ? '$' + key : JSON.stringify(key)
}
function sortedIndexOf (arr, item) {
var low = 0, high = arr.length, mid
while (low < high) {
mid = (low + high) >>> 1
arr[mid] < item ? low = mid + 1 : high = mid
}
return low
}
function MemIterator (db, options) {

@@ -100,6 +109,5 @@ AbstractIterator.call(this, db)

MemDOWN.prototype._put = function (key, value, options, callback) {
if (this._keys.indexOf(key) == -1) {
this._keys.push(key)
this._keys.sort()
}
var ix = sortedIndexOf(this._keys, key)
if (this._keys[ix] != key)
this._keys.splice(ix, 0, key)
key = toKey(key) // safety, to avoid key='__proto__'-type skullduggery

@@ -124,8 +132,5 @@ this._store[key] = value

MemDOWN.prototype._del = function (key, options, callback) {
for (var i = 0; i < this._keys.length; i++) {
if (this._keys[i] == key) {
this._keys.splice(i, 1)
break;
}
}
var ix = sortedIndexOf(this._keys, key)
if (this._keys[ix] == key)
this._keys.splice(ix, 1)
delete this._store[toKey(key)]

@@ -132,0 +137,0 @@ setImmediate(callback)

{
"name" : "memdown"
, "description" : "An drop-in replacement for LevelDOWN that works in memory only"
, "version" : "0.5.1"
, "homepage" : "https://github.com/rvagg/node-memdown"
, "authors" : [
"Rod Vagg <rod@vagg.org> (https://github.com/rvagg)"
"name": "memdown",
"description": "An drop-in replacement for LevelDOWN that works in memory only",
"version": "0.6.0",
"homepage": "https://github.com/rvagg/node-memdown",
"authors": [
"Rod Vagg <rod@vagg.org> (https://github.com/rvagg)"
],
"contributors": [
"Julian Gruber <julian@juliangruber.com> (https://github.com/juliangruber)"
],
"keywords": [
"leveldb",
"leveldown",
"levelup",
"memory"
],
"main": "./memdown.js",
"repository": {
"type": "git",
"url": "https://github.com/rvagg/node-memdown.git"
},
"dependencies": {
"abstract-leveldown": "~0.11.2",
"bops": "~0.1.1"
},
"devDependencies": {
"tape": "*",
"rimraf": "*"
},
"browser": {
"rimraf": false
},
"scripts": {
"test": "node ./test.js --stderr"
},
"testling": {
"files": "test.js",
"browsers": [
"ie/8..latest",
"firefox/17..latest",
"firefox/nightly",
"chrome/22..latest",
"chrome/canary",
"opera/12..latest",
"opera/next",
"safari/5.1..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2..latest"
]
, "contributors" : [
"Julian Gruber <julian@juliangruber.com> (https://github.com/juliangruber)"
]
, "keywords" : [ "leveldb", "leveldown", "levelup", "memory" ]
, "main" : "./memdown.js"
, "repository" : {
"type" : "git"
, "url" : "https://github.com/rvagg/node-memdown.git"
}
, "dependencies" : {
"abstract-leveldown" : "~0.11.0"
, "bops" : "~0.1.0"
}
, "devDependencies" : {
"tape" : "*"
, "rimraf" : "*"
}
, "browser" : {
"rimraf" : false
}
, "scripts" : {
"test" : "node ./test.js --stderr"
}
, "testling" : {
"files" : "test.js"
, "browsers" : [
"ie/8..latest"
, "firefox/17..latest"
, "firefox/nightly"
, "chrome/22..latest"
, "chrome/canary"
, "opera/12..latest"
, "opera/next"
, "safari/5.1..latest"
, "ipad/6.0..latest"
, "iphone/6.0..latest"
, "android-browser/4.2..latest"
]
}
, "license" : "MIT"
}
},
"license": "MIT"
}

@@ -5,10 +5,6 @@ # MemDOWN

[![NPM](https://nodei.co/npm/memdown.png?compact=true)](https://nodei.co/npm/memdown/)
[![NPM](https://nodei.co/npm/memdown.png?downloads=true)](https://nodei.co/npm/memdown/)
[![Travis](https://secure.travis-ci.org/rvagg/node-memdown.png)](http://travis-ci.org/rvagg/node-memdown)
[![Travis](https://secure.travis-ci.org/rvagg/memdown.png)](http://travis-ci.org/rvagg/memdown)
![Testling](https://ci.testling.com/rvagg/node-memdown.png)
*Note: the above tests include the use of `TypedArray`s. If you don't use them then you can likely ignore the failures.*
As of version 0.7, LevelUP allows you to pass a `'db'` option when you create a new instance. This will override the default LevelDOWN store with a LevelDOWN API compatible object. MemDOWN conforms exactly to the LevelDOWN API but only performs operations in memory, so your data is discarded when the process ends or you release a reference to the database.

@@ -19,5 +15,4 @@

```js
var MemDOWN = require('memdown')
, levelup = require('levelup')
, db = levelup('/does/not/matter', { db: MemDOWN })
var levelup = require('levelup')
, db = levelup('/does/not/matter', { db: require('memdown') })

@@ -24,0 +19,0 @@ db.put('name', 'Yuri Irsenovich Kim')

@@ -9,3 +9,3 @@ var test = require('tape')

require('abstract-leveldown/abstract/leveldown-test').args(MemDOWN, test, testCommon)
// meh require('abstract-leveldown/abstract/leveldown-test').args(MemDOWN, test, testCommon)

@@ -12,0 +12,0 @@ require('abstract-leveldown/abstract/open-test').args(MemDOWN, test, testCommon)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc