Skip to content
This repository has been archived by the owner on Aug 27, 2018. It is now read-only.

Fixed SG not generating proper configs #358

Merged
merged 7 commits into from
Sep 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed
- [[#356](https://github.com/dirigeants/komada/pull/356)] Fixes caching provider (Collection)
- [[#358](https://github.com/dirigeants/komada/pull/358)] Fixes SG Config Generation

### Removed
- [[#356](https://github.com/dirigeants/komada/pull/356)] dotenv is removed as a peerDependency
Expand Down
7 changes: 2 additions & 5 deletions src/providers/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ exports.database = new Collection();

exports.getTable = table => this.database.get(table) || this.database.set(table, new Collection()).get(table);

exports.getAll = (table) => {
const collection = this.database.get(table);
return collection ? Array.from(collection.values()) : null;
};
exports.getAll = table => Array.from(this.getTable(table).values());

exports.get = (table, id) => {
const collection = this.getTable(table);
return collection.get(id) || null;
return collection.get(id) || [];
};

exports.has = (table, id) => !!this.get(table, id);
Expand Down