Skip to content
Open
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
16 changes: 9 additions & 7 deletions src/Memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Role from './Role';
import Base from './Base';

export default class Memory extends Storage {
items: Object[] = {};
items: Object = {};

async add(item: Base): boolean {
const { name } = item;
Expand Down Expand Up @@ -94,9 +94,10 @@ export default class Memory extends Storage {
}

async getRoles(): Role[] {
return this.items
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.values(this.items)

.reduce((filtered: Role[], item: Object) => {
const { instance } = item;
const { items } = this;
return Object.keys(items)
.reduce((filtered: Role[], itemKey: String) => {
const { instance } = items[itemKey];

if (instance instanceof Role) {
filtered.push(instance);
Expand All @@ -107,9 +108,10 @@ export default class Memory extends Storage {
}

async getPermissions(): Permission[] {
return this.items
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.values(this.items)

.reduce((filtered: Permission[], item: Object) => {
const { instance } = item;
const { items } = this;
return Object.keys(items)
.reduce((filtered: Permission[], itemKey: String) => {
const { instance } = items[itemKey];

if (instance instanceof Permission) {
filtered.push(instance);
Expand Down