-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- adds types - removes fake async - fixes tests for async errors that now are sync - adds local types for merge-options
- Loading branch information
1 parent
ff1cd3a
commit 1fba61c
Showing
21 changed files
with
424 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,25 @@ | ||
'use strict' | ||
|
||
exports.create = function createBackend (name, path, options) { | ||
/** | ||
* @typedef {import("interface-datastore").Datastore} Datastore | ||
* @typedef {import("./types").Backends} Backends | ||
* @typedef {import("./types").InternalOptions} Options | ||
*/ | ||
|
||
/** | ||
* | ||
* @param {Backends} name | ||
* @param {string} path | ||
* @param {Options} options | ||
* @returns {Datastore} | ||
*/ | ||
function createBackend (name, path, options) { | ||
const Ctor = options.storageBackends[name] | ||
const backendOptions = Object.assign({}, options.storageBackendOptions[name] || {}) | ||
// @ts-ignore we don't have a signature for the constructor | ||
return new Ctor(path, backendOptions) | ||
} | ||
|
||
module.exports = { | ||
create: createBackend | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.