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

Commit 72399d7

Browse files
committed
done!
1 parent 4cf4afd commit 72399d7

6 files changed

Lines changed: 12 additions & 8 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ts-angular-jsonapi",
3-
"version": "0.3.2",
3+
"version": "0.3.12",
44
"description": "JSONAPI library developed for AngularJS in Typescript",
55
"repository": {
66
"type": "git",

src/library/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ICore, IResource } from './interfaces';
55

66
export class Core implements ICore {
77
public rootPath: string = 'http://url/';
8-
public resources: Array<IResource> = [];
8+
public resources: Object = {};
99

1010
public loadingsCounter: number = 0;
1111
public loadingsStart = () => {};

src/library/interfaces/core.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { IResource } from './resource';
22

33
export interface ICore {
44
rootPath?: string;
5-
resources?: Array<IResource>;
5+
resources?: Object;
66

77
Me?: IResource;
88
Services?: any;

src/library/interfaces/resource.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface IResource extends IDataResource {
1515
addRelationship? (resource: IResource, type_alias?: string): void;
1616
addRelationships? (resources: ICollection, type_alias: string): void;
1717
removeRelationship? (type_alias: string, id: string): boolean;
18+
addRelationshipsArray <T extends IResource>(resources: Array<T>, type_alias?: string): void;
1819
save? (params?: IParamsResource, fc_success?: Function, fc_error?: Function): any;
1920
toObject? (params?: IParamsResource): IDataObject;
2021
register? (): boolean;

src/library/resource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ export class Resource implements IResource {
462462
});
463463
}
464464

465-
public addRelationshipsArray<T extends IResource>(resources: Array<T>, type_alias?: string) {
465+
public addRelationshipsArray<T extends IResource>(resources: Array<T>, type_alias?: string): void {
466466
resources.forEach((item: IResource) => {
467467
this.addRelationship(item, type_alias || item.type);
468468
});

src/library/services/base.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ export class Base {
1717
static newCollection(): ICollection {
1818
return Object.defineProperties({}, {
1919
'$length': {
20-
get: () => {
20+
get: function() {
2121
return Object.keys(this).length * 1;
2222
},
2323
enumerable: false
2424
},
2525
'$toArray': {
26-
get: () => {
27-
return $.map(this, (val) => {
28-
return val;
26+
get: function() {
27+
let self = this;
28+
return Object.keys(this).map(function (key) {
29+
return self[key];
30+
// var value = self[key];
31+
// return Object.defineProperty(value, '$key', { enumerable: false, value: key + 5});
2932
});
3033
},
3134
enumerable: false

0 commit comments

Comments
 (0)