fdboost
Version:
Performance enhanced utilities for FoundationDB
34 lines (25 loc) • 729 B
text/coffeescript
enhance = require('./enhance')
latestVersion = 300
instance = null
class Booster
fdb: null
Debug: require('./debug')
boost: (fdb) ->
enhance(fdb)
fdb
Object.defineProperty @::, 'factory',
get: ->
factory = (version) ->
if (typeof(version) is 'object')
factory.use(version)
else
factory.apiVersion(version)
factory.apiVersion = (version = latestVersion) =>
= require('fdb').apiVersion(version) if is null
( )
factory.use = (fdb) =>
throw new Error('Must provide fdbModule instance') unless fdb
(fdb)
factory
booster = new Booster() if instance is null
module.exports = booster.factory