Comparing version 1.3.5 to 1.3.6
@@ -29,3 +29,3 @@ /* Copyright (c) 2012-2016 LevelUP contributors | ||
, defaultOptions = util.defaultOptions | ||
, getLevelDOWN = util.getLevelDOWN | ||
, getLevelDOWN = require('./leveldown') | ||
, dispatchError = util.dispatchError | ||
@@ -32,0 +32,0 @@ , isDefined = util.isDefined |
@@ -8,4 +8,2 @@ /* Copyright (c) 2012-2016 LevelUP contributors | ||
var extend = require('xtend') | ||
, LevelUPError = require('level-errors').LevelUPError | ||
, format = require('util').format | ||
, defaultOptions = { | ||
@@ -19,4 +17,2 @@ createIfMissing : true | ||
, leveldown | ||
function getOptions (options) { | ||
@@ -30,37 +26,2 @@ if (typeof options == 'string') | ||
function getLevelDOWN () { | ||
if (leveldown) | ||
return leveldown | ||
var requiredVersion = require('../package.json').devDependencies.leveldown | ||
, leveldownVersion | ||
try { | ||
leveldownVersion = require('leveldown/package.json').version | ||
} catch (e) { | ||
throw requireError(e) | ||
} | ||
if (!require('semver').satisfies(leveldownVersion, requiredVersion)) { | ||
throw new LevelUPError( | ||
'Installed version of LevelDOWN (' | ||
+ leveldownVersion | ||
+ ') does not match required version (' | ||
+ requiredVersion | ||
+ ')' | ||
) | ||
} | ||
try { | ||
return leveldown = require('leveldown') | ||
} catch (e) { | ||
throw requireError(e) | ||
} | ||
} | ||
function requireError (e) { | ||
var template = 'Failed to require LevelDOWN (%s). Try `npm install leveldown` if it\'s missing' | ||
return new LevelUPError(format(template, e.message)) | ||
} | ||
function dispatchError (db, error, callback) { | ||
@@ -77,5 +38,4 @@ typeof callback == 'function' ? callback(error) : db.emit('error', error) | ||
, getOptions : getOptions | ||
, getLevelDOWN : getLevelDOWN | ||
, dispatchError : dispatchError | ||
, isDefined : isDefined | ||
} |
{ | ||
"name": "levelup", | ||
"description": "Fast & simple storage - a Node.js-style LevelDB wrapper", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"contributors": [ | ||
@@ -47,2 +47,3 @@ "Rod Vagg <r@va.gg> (https://github.com/rvagg)", | ||
"async": "~1.5.0", | ||
"browserify": "^14.3.0", | ||
"bustermove": "~1.0.0", | ||
@@ -61,2 +62,3 @@ "tap": "~2.3.1", | ||
"browser": { | ||
"./lib/leveldown.js": false, | ||
"leveldown": false, | ||
@@ -63,0 +65,0 @@ "leveldown/package": false, |
@@ -17,3 +17,3 @@ /* Copyright (c) 2012-2016 LevelUP contributors | ||
delete require.cache[require.resolve('leveldown/package')] | ||
delete require.cache[require.resolve('../lib/util')] | ||
delete require.cache[require.resolve('../lib/leveldown')] | ||
} | ||
@@ -26,4 +26,4 @@ | ||
, 'test getLevelDOWN()': function () { | ||
var util = require('../lib/util') | ||
assert.same(util.getLevelDOWN(), require('leveldown'), 'correct leveldown provided') | ||
var getLevelDOWN = require('../lib/leveldown') | ||
assert.same(getLevelDOWN(), require('leveldown'), 'correct leveldown provided') | ||
} | ||
@@ -30,0 +30,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
181891
37
3319
13