UNPKG

leveldb

Version:

Bindings for using LevelDB through node.

40 lines (29 loc) 1.35 kB
// Generated by CoffeeScript 1.3.3 var binding, exports, leveldb; leveldb = exports = module.exports = require('./leveldb/handle'); binding = require('../build/Release/leveldb.node'); leveldb.version = '0.7.0'; leveldb.bindingVersion = "" + binding.majorVersion + "." + binding.minorVersion; leveldb.Batch = require('./leveldb/batch').Batch; /* Create a partitioned bitwise comparator for use with opening a database. @param {Array} partitions Partition configuration data. @param {Array} partitions[] Slice configuration. @param {Integer} partitions[][0] Number of bytes in this slice. Use zero to set the sorting direction for all bytes from the current offset until the next slice or the end of the key. @param {Boolean} partitions[][1] If true, use reverse bitwise sorting until the next slice or the end of the key. */ leveldb.partitionedBitwiseComparator = function() { var args, bounds, limit, reverse, _i, _len, _ref; args = Array.prototype.slice.call(arguments); args = Array.isArray(args[0][0]) ? args[0] : args; bounds = []; for (_i = 0, _len = args.length; _i < _len; _i++) { _ref = args[_i], limit = _ref[0], reverse = _ref[1]; bounds.push(parseInt(limit)); bounds.push(!!reverse); } return binding.createPartitionedBitwiseComparator(bounds); };