Skip to content
This repository was archived by the owner on Jan 17, 2019. It is now read-only.

Commit ef9cdc5

Browse files
committed
v0.4.3
- Renew environment. - Add new style code. - Update code to latest ECMAScript syntax.
1 parent 877100a commit ef9cdc5

11 files changed

Lines changed: 3915 additions & 121 deletions

File tree

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[*]
2+
indent_size = 4
3+
4+
[package.json]
5+
indent_size = 2

.eslintrc.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
module.exports = {
4+
extends: [ 'standard' ],
5+
env: {
6+
es6: true,
7+
node: true
8+
},
9+
rules: {
10+
indent: [ 'error', 4 ],
11+
semi: [ 'error', 'always' ],
12+
'no-multi-spaces': 0
13+
}
14+
};

.jshintrc

Lines changed: 0 additions & 14 deletions
This file was deleted.

.travis.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
language: node_js
22
node_js:
3-
- 4.0
4-
- 5.0
5-
- 6.0
6-
before_install: npm install -g npm@latest
3+
- 8.0
74
install:
8-
- npm install bool.js
5+
- npm install booljs
96
- npm install

index.js

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,41 @@
11
'use strict';
22

3-
var fs = require('fs')
4-
, path = require('path')
5-
, async = require('async');
3+
const NoModel = require('./model');
4+
const { join } = require('path');
5+
const { readFileSync } = require('fs');
6+
const { DatabaseLoader } = require('booljs.api');
67

7-
var API = require('booljs.api');
8-
9-
module.exports = class BoolJSNoModel extends API.DatabaseLoader{
10-
constructor() {
8+
module.exports = class BoolJSNoModel extends DatabaseLoader {
9+
constructor () {
1110
super('booljs.nomodel');
1211
}
1312

1413
/** @ignore */
15-
openDatabase(config) {
16-
return q.resolve();
17-
}
18-
19-
/** @ignore */
20-
fetchModels(_instance, models) {
21-
var fetch = q.nbind(async.forEachOfSeries, async);
14+
async openDatabase (config) {}
2215

23-
return fetch(models, function (path, model, next) {
24-
var Model = require(path);
16+
modelClass () { return NoModel; }
2517

26-
var _model = function () {
27-
return new Model(_instance.getComponents());
28-
};
29-
_instance.insertComponent(
30-
model, _model, _instance.getComponents().models
31-
);
32-
33-
next();
34-
});
18+
/** @ignore */
19+
async fetchModels (connection, Model, instance) {
20+
let modelClass = this.modelClass();
21+
return class extends modelClass {
22+
constructor (...params) {
23+
return new (Function.prototype.bind.apply(Model, [
24+
null, instance.getComponents()
25+
].concat(params)))();
26+
}
27+
};
3528
}
29+
3630
/** @ignore */
37-
modelTemplate() {
38-
return fs.readFileSync(path.join(
39-
require.resolve('.'), '../templates/model.js'
40-
));
31+
modelTemplate () {
32+
return readFileSync(
33+
join(require.resolve('.'), '../templates/model.js')
34+
);
4135
}
4236

4337
/** @ignore */
44-
modelConfiguration() {
38+
modelConfiguration () {
4539
return false;
4640
}
4741
};

model.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
const { DatabaseModel } = require('booljs.api');
4+
5+
module.exports = class NoModel extends DatabaseModel {
6+
constructor () { super(); }
7+
};

0 commit comments

Comments
 (0)