xdriver 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Database.d.ts CHANGED
@@ -10,7 +10,8 @@ export default class Database {
10
10
  open(name?: string | undefined, version?: number | undefined): Promise<unknown>;
11
11
  drop(): Promise<unknown>;
12
12
  close(): void;
13
- createTable(tab: string | object): Table;
13
+ createTable(tab: string | object, options?: object): Table;
14
+ createTables(tables: Array<string | object>, options?: object): Table[];
14
15
  dropTable(tableName: string): any;
15
16
  table(tableName: string): Table;
16
17
  exists(table: string): any;
package/lib/Database.js CHANGED
@@ -92,13 +92,25 @@ export default class Database {
92
92
  this.connect = null;
93
93
  }
94
94
  }
95
- createTable(tab) {
95
+ createTable(tab, options) {
96
96
  let table = tab;
97
97
  if (_instance(tab, String)) {
98
- table = { name: tab };
98
+ table = Object.assign({ name: tab }, options);
99
99
  }
100
100
  return new Table(table, this);
101
101
  }
102
+ createTables(tables, options) {
103
+ return tables.map(table => {
104
+ let opts = Object.assign({}, options);
105
+ if (_instance(table, String)) {
106
+ Object.assign(opts, { name: table });
107
+ }
108
+ else {
109
+ Object.assign(opts, table);
110
+ }
111
+ return new Table(opts, this);
112
+ });
113
+ }
102
114
  dropTable(tableName) {
103
115
  return this.connect.deleteObjectStore(tableName);
104
116
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xdriver",
3
- "version": "1.0.01",
4
- "description": "xdriver",
3
+ "version": "1.0.02",
4
+ "description": "A simple driver for IndexDB",
5
5
  "main": "./lib/index",
6
6
  "files": [
7
7
  "lib/"