\n "
47 | }),
48 | __metadata('design:paramtypes', [user_service_1.UserService, auth_service_1.AuthService, router_1.Router])
49 | ], AppComponent);
50 | return AppComponent;
51 | }());
52 | exports.AppComponent = AppComponent;
53 | //# sourceMappingURL=app.component.js.map
--------------------------------------------------------------------------------
/dist/app.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"app.component.js","sourceRoot":"","sources":["../app/app.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAkC,eAAe,CAAC,CAAA;AAClD,uBAAuB,iBAAiB,CAAC,CAAA;AAGzC,6BAA4B,gCAAgC,CAAC,CAAA;AAC7D,6BAA4B,gCAAgC,CAAC,CAAA;AA4B7D;IAGE,sBACU,WAAwB,EACxB,WAAwB,EACxB,MAAc;QAFd,gBAAW,GAAX,WAAW,CAAa;QACxB,gBAAW,GAAX,WAAW,CAAa;QACxB,WAAM,GAAN,MAAM,CAAQ;IACrB,CAAC;IAEJ,+BAAQ,GAAR;QAAA,iBAKC;QAJC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;aACxB,SAAS,CACR,UAAA,KAAK,IAAI,OAAA,KAAI,CAAC,KAAK,GAAG,KAAK,EAAlB,CAAkB,CAC5B,CAAC;IACN,CAAC;IAKD,sBAAI,oCAAU;QAHd;;WAEG;aACH;YACE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;QACvC,CAAC;;;OAAA;IAED;;OAEG;IACH,6BAAM,GAAN;QACE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;QAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IACnC,CAAC;IAvDH;QAAC,gBAAS,CAAC;YACT,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,+qBAsBT;SACF,CAAC;;oBAAA;IA+BF,mBAAC;AAAD,CAAC,AA9BD,IA8BC;AA9BY,oBAAY,eA8BxB,CAAA"}
--------------------------------------------------------------------------------
/dist/app.module.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | var core_1 = require('@angular/core');
12 | var platform_browser_1 = require('@angular/platform-browser');
13 | var http_1 = require('@angular/http');
14 | var forms_1 = require('@angular/forms');
15 | var app_routing_1 = require('./app.routing');
16 | var app_component_1 = require('./app.component');
17 | var user_service_1 = require('./shared/services/user.service');
18 | var users_component_1 = require('./users/users.component');
19 | var user_list_component_1 = require('./users/user-list/user-list.component');
20 | var user_single_component_1 = require('./users/user-single/user-single.component');
21 | var user_edit_component_1 = require('./users/user-edit/user-edit.component');
22 | var user_create_component_1 = require('./users/user-create/user-create.component');
23 | var login_component_1 = require('./login/login.component');
24 | var auth_service_1 = require('./shared/services/auth.service');
25 | require('rxjs/add/operator/map');
26 | require('rxjs/add/operator/toPromise');
27 | require('rxjs/add/operator/catch');
28 | require('rxjs/add/operator/do');
29 | require('rxjs/add/observable/throw');
30 | var AppModule = (function () {
31 | function AppModule() {
32 | }
33 | AppModule = __decorate([
34 | core_1.NgModule({
35 | imports: [
36 | platform_browser_1.BrowserModule,
37 | http_1.HttpModule,
38 | forms_1.FormsModule,
39 | app_routing_1.routing
40 | ],
41 | declarations: [
42 | app_component_1.AppComponent,
43 | users_component_1.UsersComponent,
44 | user_list_component_1.UserListComponent,
45 | user_single_component_1.UserSingleComponent,
46 | user_edit_component_1.UserEditComponent,
47 | user_create_component_1.UserCreateComponent,
48 | login_component_1.LoginComponent
49 | ],
50 | providers: [
51 | user_service_1.UserService,
52 | auth_service_1.AuthService
53 | ],
54 | bootstrap: [app_component_1.AppComponent]
55 | }),
56 | __metadata('design:paramtypes', [])
57 | ], AppModule);
58 | return AppModule;
59 | }());
60 | exports.AppModule = AppModule;
61 | //# sourceMappingURL=app.module.js.map
--------------------------------------------------------------------------------
/dist/app.module.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../app/app.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAyB,eAAe,CAAC,CAAA;AACzC,iCAA8B,2BAA2B,CAAC,CAAA;AAC1D,qBAA2B,eAAe,CAAC,CAAA;AAC3C,sBAA4B,gBAAgB,CAAC,CAAA;AAC7C,4BAAwB,eAAe,CAAC,CAAA;AACxC,8BAA6B,iBAAiB,CAAC,CAAA;AAE/C,6BAA4B,gCAAgC,CAAC,CAAA;AAC7D,gCAA+B,yBAAyB,CAAC,CAAA;AACzD,oCAAkC,uCAAuC,CAAC,CAAA;AAC1E,sCAAoC,2CAA2C,CAAC,CAAA;AAChF,oCAAkC,uCAAuC,CAAC,CAAA;AAC1E,sCAAoC,2CAA2C,CAAC,CAAA;AAChF,gCAA+B,yBAAyB,CAAC,CAAA;AACzD,6BAA4B,gCAAgC,CAAC,CAAA;AAE7D,QAAO,uBAAuB,CAAC,CAAA;AAC/B,QAAO,6BAA6B,CAAC,CAAA;AACrC,QAAO,yBAAyB,CAAC,CAAA;AACjC,QAAO,sBAAsB,CAAC,CAAA;AAC9B,QAAO,2BAA2B,CAAC,CAAA;AAwBnC;IAAA;IAAwB,CAAC;IAtBzB;QAAC,eAAQ,CAAC;YACR,OAAO,EAAE;gBACP,gCAAa;gBACb,iBAAU;gBACV,mBAAW;gBACX,qBAAO;aACR;YACD,YAAY,EAAE;gBACZ,4BAAY;gBACZ,gCAAc;gBACd,uCAAiB;gBACjB,2CAAmB;gBACnB,uCAAiB;gBACjB,2CAAmB;gBACnB,gCAAc;aACf;YACD,SAAS,EAAE;gBACT,0BAAW;gBACX,0BAAW;aACZ;YACD,SAAS,EAAE,CAAE,4BAAY,CAAE;SAC5B,CAAC;;iBAAA;IACsB,gBAAC;AAAD,CAAC,AAAzB,IAAyB;AAAZ,iBAAS,YAAG,CAAA"}
--------------------------------------------------------------------------------
/dist/app.routing.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var router_1 = require('@angular/router');
3 | var users_component_1 = require('./users/users.component');
4 | var user_list_component_1 = require('./users/user-list/user-list.component');
5 | var user_single_component_1 = require('./users/user-single/user-single.component');
6 | var user_edit_component_1 = require('./users/user-edit/user-edit.component');
7 | var user_create_component_1 = require('./users/user-create/user-create.component');
8 | var login_component_1 = require('./login/login.component');
9 | exports.routes = [
10 | {
11 | path: '',
12 | redirectTo: '/users',
13 | pathMatch: 'full'
14 | },
15 | {
16 | path: 'login',
17 | component: login_component_1.LoginComponent
18 | },
19 | {
20 | path: 'users',
21 | component: users_component_1.UsersComponent,
22 | children: [
23 | {
24 | path: '',
25 | component: user_list_component_1.UserListComponent
26 | },
27 | {
28 | path: 'create',
29 | component: user_create_component_1.UserCreateComponent
30 | },
31 | {
32 | path: ':id',
33 | component: user_single_component_1.UserSingleComponent
34 | },
35 | {
36 | path: ':id/edit',
37 | component: user_edit_component_1.UserEditComponent
38 | }
39 | ]
40 | }
41 | ];
42 | exports.routing = router_1.RouterModule.forRoot(exports.routes);
43 | //# sourceMappingURL=app.routing.js.map
--------------------------------------------------------------------------------
/dist/app.routing.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"app.routing.js","sourceRoot":"","sources":["../app/app.routing.ts"],"names":[],"mappings":";AACA,uBAAqC,iBAAiB,CAAC,CAAA;AACvD,gCAA+B,yBAAyB,CAAC,CAAA;AACzD,oCAAkC,uCAAuC,CAAC,CAAA;AAC1E,sCAAoC,2CAA2C,CAAC,CAAA;AAChF,oCAAkC,uCAAuC,CAAC,CAAA;AAC1E,sCAAoC,2CAA2C,CAAC,CAAA;AAChF,gCAA+B,yBAAyB,CAAC,CAAA;AAE5C,cAAM,GAAW;IAC5B;QACE,IAAI,EAAE,EAAE;QACR,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,MAAM;KAClB;IACD;QACE,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,gCAAc;KAC1B;IACD;QACE,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,gCAAc;QACzB,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,EAAE;gBACR,SAAS,EAAE,uCAAiB;aAC7B;YACD;gBACE,IAAI,EAAE,QAAQ;gBACd,SAAS,EAAE,2CAAmB;aAC/B;YACD;gBACE,IAAI,EAAE,KAAK;gBACX,SAAS,EAAE,2CAAmB;aAC/B;YACD;gBACE,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,uCAAiB;aAC7B;SACF;KACF;CACF,CAAC;AAEW,eAAO,GAAwB,qBAAY,CAAC,OAAO,CAAC,cAAM,CAAC,CAAC"}
--------------------------------------------------------------------------------
/dist/login/login.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | var core_1 = require('@angular/core');
12 | var router_1 = require('@angular/router');
13 | var auth_service_1 = require('../shared/services/auth.service');
14 | var LoginComponent = (function () {
15 | function LoginComponent(service, router) {
16 | this.service = service;
17 | this.router = router;
18 | this.credentials = { username: '', password: '' };
19 | this.successMessage = '';
20 | this.errorMessage = '';
21 | }
22 | LoginComponent.prototype.ngOnInit = function () { };
23 | /**
24 | * Login a user
25 | */
26 | LoginComponent.prototype.login = function () {
27 | var _this = this;
28 | this.errorMessage = '';
29 | this.service.login(this.credentials.username, this.credentials.password)
30 | .subscribe(function (data) {
31 | _this.router.navigate(['']);
32 | console.log(data);
33 | }, function (err) {
34 | _this.errorMessage = err;
35 | console.error(err);
36 | });
37 | };
38 | LoginComponent = __decorate([
39 | core_1.Component({
40 | templateUrl: './app/login/login.component.html'
41 | }),
42 | __metadata('design:paramtypes', [auth_service_1.AuthService, router_1.Router])
43 | ], LoginComponent);
44 | return LoginComponent;
45 | }());
46 | exports.LoginComponent = LoginComponent;
47 | //# sourceMappingURL=login.component.js.map
--------------------------------------------------------------------------------
/dist/login/login.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"login.component.js","sourceRoot":"","sources":["../../app/login/login.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAkC,eAAe,CAAC,CAAA;AAClD,uBAAuB,iBAAiB,CAAC,CAAA;AACzC,6BAA4B,iCAAiC,CAAC,CAAA;AAK9D;IAKE,wBAAoB,OAAoB,EAAU,MAAc;QAA5C,YAAO,GAAP,OAAO,CAAa;QAAU,WAAM,GAAN,MAAM,CAAQ;QAJhE,gBAAW,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;QAC7C,mBAAc,GAAW,EAAE,CAAC;QAC5B,iBAAY,GAAW,EAAE,CAAC;IAE0C,CAAC;IAErE,iCAAQ,GAAR,cAAY,CAAC;IAEb;;OAEG;IACH,8BAAK,GAAL;QAAA,iBAcC;QAbC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QAEvB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;aACrE,SAAS,CACR,UAAA,IAAI;YACF,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC,EACD,UAAA,GAAG;YACD,KAAI,CAAC,YAAY,GAAG,GAAG,CAAC;YACxB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,CACF,CAAC;IACN,CAAC;IA7BH;QAAC,gBAAS,CAAC;YACT,WAAW,EAAE,kCAAkC;SAChD,CAAC;;sBAAA;IA6BF,qBAAC;AAAD,CAAC,AA5BD,IA4BC;AA5BY,sBAAc,iBA4B1B,CAAA"}
--------------------------------------------------------------------------------
/dist/main.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var platform_browser_dynamic_1 = require('@angular/platform-browser-dynamic');
3 | var app_module_1 = require('./app.module');
4 | platform_browser_dynamic_1.platformBrowserDynamic().bootstrapModule(app_module_1.AppModule);
5 | //# sourceMappingURL=main.js.map
--------------------------------------------------------------------------------
/dist/main.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"main.js","sourceRoot":"","sources":["../app/main.ts"],"names":[],"mappings":";AAAA,yCAAuC,mCAAmC,CAAC,CAAA;AAC3E,2BAA0B,cAAc,CAAC,CAAA;AAEzC,iDAAsB,EAAE,CAAC,eAAe,CAAC,sBAAS,CAAC,CAAC"}
--------------------------------------------------------------------------------
/dist/shared/models/user.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var User = (function () {
3 | function User() {
4 | }
5 | return User;
6 | }());
7 | exports.User = User;
8 | //# sourceMappingURL=user.js.map
--------------------------------------------------------------------------------
/dist/shared/models/user.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"user.js","sourceRoot":"","sources":["../../../app/shared/models/user.ts"],"names":[],"mappings":";AAAA;IAAA;IAKA,CAAC;IAAD,WAAC;AAAD,CAAC,AALD,IAKC;AALY,YAAI,OAKhB,CAAA"}
--------------------------------------------------------------------------------
/dist/shared/services/auth.service.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | var core_1 = require('@angular/core');
12 | var http_1 = require('@angular/http');
13 | var Observable_1 = require('rxjs/Observable');
14 | var AuthService = (function () {
15 | function AuthService(http) {
16 | this.http = http;
17 | this.authUrl = 'http://reqres.in/api';
18 | this.loggedIn = false;
19 | // look at localStorage to check if the user is logged in
20 | this.loggedIn = !!localStorage.getItem('auth_token');
21 | }
22 | /**
23 | * Check if the user is logged in
24 | */
25 | AuthService.prototype.isLoggedIn = function () {
26 | return this.loggedIn;
27 | };
28 | /**
29 | * Log the user in
30 | */
31 | AuthService.prototype.login = function (username, password) {
32 | var _this = this;
33 | return this.http.post(this.authUrl + "/login", { username: username, password: password })
34 | .map(function (res) { return res.json(); })
35 | .do(function (res) {
36 | if (res.token) {
37 | localStorage.setItem('auth_token', res.token);
38 | _this.loggedIn = true;
39 | }
40 | })
41 | .catch(this.handleError);
42 | };
43 | /**
44 | * Log the user out
45 | */
46 | AuthService.prototype.logout = function () {
47 | localStorage.removeItem('auth_token');
48 | this.loggedIn = false;
49 | };
50 | /**
51 | * Handle any errors from the API
52 | */
53 | AuthService.prototype.handleError = function (err) {
54 | var errMessage;
55 | if (err instanceof http_1.Response) {
56 | var body = err.json() || '';
57 | var error = body.error || JSON.stringify(body);
58 | errMessage = err.status + " - " + (err.statusText || '') + " " + error;
59 | }
60 | else {
61 | errMessage = err.message ? err.message : err.toString();
62 | }
63 | return Observable_1.Observable.throw(errMessage);
64 | };
65 | AuthService = __decorate([
66 | core_1.Injectable(),
67 | __metadata('design:paramtypes', [http_1.Http])
68 | ], AuthService);
69 | return AuthService;
70 | }());
71 | exports.AuthService = AuthService;
72 | //# sourceMappingURL=auth.service.js.map
--------------------------------------------------------------------------------
/dist/shared/services/auth.service.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../../app/shared/services/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAA2B,eAAe,CAAC,CAAA;AAC3C,qBAA+B,eAAe,CAAC,CAAA;AAC/C,2BAA2B,iBAAiB,CAAC,CAAA;AAG7C;IAIE,qBAAoB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;QAHtB,YAAO,GAAW,sBAAsB,CAAC;QACzC,aAAQ,GAAY,KAAK,CAAC;QAGhC,yDAAyD;QACzD,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,gCAAU,GAAV;QACE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,2BAAK,GAAL,UAAM,QAAgB,EAAE,QAAgB;QAAxC,iBAUC;QATC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAI,IAAI,CAAC,OAAO,WAAQ,EAAE,EAAE,kBAAQ,EAAE,kBAAQ,EAAE,CAAC;aACnE,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC;aACtB,EAAE,CAAC,UAAA,GAAG;YACL,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;gBACd,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;gBAC9C,KAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACvB,CAAC;QACH,CAAC,CAAC;aACD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,4BAAM,GAAN;QACE,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IAED;;OAEG;IACK,iCAAW,GAAnB,UAAoB,GAAG;QACrB,IAAI,UAAkB,CAAC;QAEvB,EAAE,CAAC,CAAC,GAAG,YAAY,eAAQ,CAAC,CAAC,CAAC;YAC5B,IAAI,IAAI,GAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;YAC9B,IAAI,KAAK,GAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAChD,UAAU,GAAM,GAAG,CAAC,MAAM,YAAM,GAAG,CAAC,UAAU,IAAI,EAAE,UAAI,KAAO,CAAC;QAClE,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,UAAU,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC1D,CAAC;QAED,MAAM,CAAC,uBAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAvDH;QAAC,iBAAU,EAAE;;mBAAA;IAyDb,kBAAC;AAAD,CAAC,AAxDD,IAwDC;AAxDY,mBAAW,cAwDvB,CAAA"}
--------------------------------------------------------------------------------
/dist/shared/services/user.service.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | var core_1 = require('@angular/core');
12 | var http_1 = require('@angular/http');
13 | var Observable_1 = require('rxjs/Observable');
14 | var Subject_1 = require('rxjs/Subject');
15 | var UserService = (function () {
16 | function UserService(http) {
17 | this.http = http;
18 | this.usersUrl = 'http://reqres.in/api/users';
19 | // observable source
20 | this.userCreatedSource = new Subject_1.Subject();
21 | this.userDeletedSource = new Subject_1.Subject();
22 | // observable stream
23 | this.userCreated$ = this.userCreatedSource.asObservable();
24 | this.userDeleted$ = this.userDeletedSource.asObservable();
25 | }
26 | /**
27 | * Get all users
28 | */
29 | UserService.prototype.getUsers = function () {
30 | var _this = this;
31 | return this.http.get(this.usersUrl)
32 | .map(function (res) { return res.json().data; })
33 | .map(function (users) { return users.map(_this.toUser); })
34 | .catch(this.handleError);
35 | };
36 | /**
37 | * Get a single user
38 | */
39 | UserService.prototype.getUser = function (id) {
40 | // attaching a token
41 | var headers = new http_1.Headers();
42 | var token = localStorage.getItem('auth_token');
43 | headers.append('Content-Type', 'application/json');
44 | headers.append('Authorization', "Bearer " + token);
45 | return this.http.get(this.usersUrl + "/" + id, { headers: headers })
46 | .map(function (res) { return res.json().data; })
47 | .map(this.toUser)
48 | .catch(this.handleError);
49 | };
50 | /**
51 | * Create the user
52 | */
53 | UserService.prototype.createUser = function (user) {
54 | var _this = this;
55 | return this.http.post(this.usersUrl, user)
56 | .map(function (res) { return res.json(); })
57 | .do(function (user) { return _this.userCreated(user); })
58 | .catch(this.handleError);
59 | };
60 | /**
61 | * Update the user
62 | */
63 | UserService.prototype.updateUser = function (user) {
64 | return this.http.put(this.usersUrl + "/" + user.id, user)
65 | .map(function (res) { return res.json(); })
66 | .catch(this.handleError);
67 | };
68 | /**
69 | * Delete the user
70 | */
71 | UserService.prototype.deleteUser = function (id) {
72 | var _this = this;
73 | return this.http.delete(this.usersUrl + "/" + id)
74 | .do(function (res) { return _this.userDeleted(); })
75 | .catch(this.handleError);
76 | };
77 | /**
78 | * The user was created. Add this info to our stream
79 | */
80 | UserService.prototype.userCreated = function (user) {
81 | this.userCreatedSource.next(user);
82 | };
83 | /**
84 | * The user was deleted. Add this info to our stream
85 | */
86 | UserService.prototype.userDeleted = function () {
87 | this.userDeletedSource.next();
88 | };
89 | /**
90 | * Convert user info from the API to our standard/format
91 | */
92 | UserService.prototype.toUser = function (user) {
93 | return {
94 | id: user.id,
95 | name: user.first_name + " " + user.last_name,
96 | username: user.first_name,
97 | avatar: user.avatar
98 | };
99 | };
100 | /**
101 | * Handle any errors from the API
102 | */
103 | UserService.prototype.handleError = function (err) {
104 | var errMessage;
105 | if (err instanceof http_1.Response) {
106 | var body = err.json() || '';
107 | var error = body.error || JSON.stringify(body);
108 | errMessage = err.status + " - " + (err.statusText || '') + " " + error;
109 | }
110 | else {
111 | errMessage = err.message ? err.message : err.toString();
112 | }
113 | return Observable_1.Observable.throw(errMessage);
114 | };
115 | UserService = __decorate([
116 | core_1.Injectable(),
117 | __metadata('design:paramtypes', [http_1.Http])
118 | ], UserService);
119 | return UserService;
120 | }());
121 | exports.UserService = UserService;
122 | //# sourceMappingURL=user.service.js.map
--------------------------------------------------------------------------------
/dist/shared/services/user.service.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../../app/shared/services/user.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAA2B,eAAe,CAAC,CAAA;AAC3C,qBAAwC,eAAe,CAAC,CAAA;AACxD,2BAA2B,iBAAiB,CAAC,CAAA;AAC7C,wBAAwB,cAAc,CAAC,CAAA;AAIvC;IAWE,qBAAoB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;QAVtB,aAAQ,GAAW,4BAA4B,CAAC;QAExD,oBAAoB;QACZ,sBAAiB,GAAG,IAAI,iBAAO,EAAQ,CAAC;QACxC,sBAAiB,GAAG,IAAI,iBAAO,EAAE,CAAC;QAE1C,oBAAoB;QACpB,iBAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC;QACrD,iBAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC;IAEpB,CAAC;IAElC;;OAEG;IACH,8BAAQ,GAAR;QAAA,iBAKC;QAJC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;aAChC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,EAAf,CAAe,CAAC;aAC3B,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,GAAG,CAAC,KAAI,CAAC,MAAM,CAAC,EAAtB,CAAsB,CAAC;aACpC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,6BAAO,GAAP,UAAQ,EAAU;QAChB,oBAAoB;QACpB,IAAI,OAAO,GAAG,IAAI,cAAO,EAAE,CAAC;QAC5B,IAAI,KAAK,GAAK,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QACnD,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,YAAU,KAAO,CAAC,CAAC;QAEnD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAI,IAAI,CAAC,QAAQ,SAAI,EAAI,EAAE,EAAE,gBAAO,EAAE,CAAC;aACxD,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,EAAf,CAAe,CAAC;aAC3B,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;aAChB,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,gCAAU,GAAV,UAAW,IAAU;QAArB,iBAKC;QAJC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC;aACvC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC;aACtB,EAAE,CAAC,UAAA,IAAI,IAAI,OAAA,KAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAtB,CAAsB,CAAC;aAClC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,gCAAU,GAAV,UAAW,IAAU;QACnB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAI,IAAI,CAAC,QAAQ,SAAI,IAAI,CAAC,EAAI,EAAE,IAAI,CAAC;aACtD,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC;aACtB,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,gCAAU,GAAV,UAAW,EAAU;QAArB,iBAIC;QAHC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAI,IAAI,CAAC,QAAQ,SAAI,EAAI,CAAC;aAC9C,EAAE,CAAC,UAAA,GAAG,IAAI,OAAA,KAAI,CAAC,WAAW,EAAE,EAAlB,CAAkB,CAAC;aAC7B,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,iCAAW,GAAX,UAAY,IAAU;QACpB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,iCAAW,GAAX;QACE,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;IAED;;OAEG;IACK,4BAAM,GAAd,UAAe,IAAI;QACjB,MAAM,CAAC;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAK,IAAI,CAAC,UAAU,SAAI,IAAI,CAAC,SAAW;YAC5C,QAAQ,EAAE,IAAI,CAAC,UAAU;YACzB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,iCAAW,GAAnB,UAAoB,GAAG;QACrB,IAAI,UAAkB,CAAC;QAEvB,EAAE,CAAC,CAAC,GAAG,YAAY,eAAQ,CAAC,CAAC,CAAC;YAC5B,IAAI,IAAI,GAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;YAC9B,IAAI,KAAK,GAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAChD,UAAU,GAAM,GAAG,CAAC,MAAM,YAAM,GAAG,CAAC,UAAU,IAAI,EAAE,UAAI,KAAO,CAAC;QAClE,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,UAAU,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC1D,CAAC;QAED,MAAM,CAAC,uBAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IA7GH;QAAC,iBAAU,EAAE;;mBAAA;IA+Gb,kBAAC;AAAD,CAAC,AA9GD,IA8GC;AA9GY,mBAAW,cA8GvB,CAAA"}
--------------------------------------------------------------------------------
/dist/users/user-create/user-create.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | var core_1 = require('@angular/core');
12 | var router_1 = require('@angular/router');
13 | var user_service_1 = require('../../shared/services/user.service');
14 | var UserCreateComponent = (function () {
15 | function UserCreateComponent(service, router) {
16 | this.service = service;
17 | this.router = router;
18 | this.user = { name: '', username: '', avatar: '' };
19 | this.successMessage = '';
20 | this.errorMessage = '';
21 | }
22 | UserCreateComponent.prototype.ngOnInit = function () {
23 | };
24 | /**
25 | * Create a user
26 | */
27 | UserCreateComponent.prototype.createUser = function () {
28 | var _this = this;
29 | this.successMessage = '';
30 | this.errorMessage = '';
31 | this.service.createUser(this.user)
32 | .subscribe(function (user) {
33 | _this.successMessage = 'User was created!';
34 | console.log('user was created');
35 | // navigate back to the users page
36 | _this.router.navigate(['/users']);
37 | });
38 | };
39 | UserCreateComponent = __decorate([
40 | core_1.Component({
41 | templateUrl: './app/users/user-create/user-create.component.html'
42 | }),
43 | __metadata('design:paramtypes', [user_service_1.UserService, router_1.Router])
44 | ], UserCreateComponent);
45 | return UserCreateComponent;
46 | }());
47 | exports.UserCreateComponent = UserCreateComponent;
48 | //# sourceMappingURL=user-create.component.js.map
--------------------------------------------------------------------------------
/dist/users/user-create/user-create.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"user-create.component.js","sourceRoot":"","sources":["../../../app/users/user-create/user-create.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAkC,eAAe,CAAC,CAAA;AAClD,uBAAuB,iBAAiB,CAAC,CAAA;AAEzC,6BAA4B,oCAAoC,CAAC,CAAA;AAKjE;IAKE,6BAAoB,OAAoB,EAAU,MAAc;QAA5C,YAAO,GAAP,OAAO,CAAa;QAAU,WAAM,GAAN,MAAM,CAAQ;QAJhE,SAAI,GAAS,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QACpD,mBAAc,GAAW,EAAE,CAAC;QAC5B,iBAAY,GAAW,EAAE,CAAC;IAE0C,CAAC;IAErE,sCAAQ,GAAR;IACA,CAAC;IAED;;OAEG;IACH,wCAAU,GAAV;QAAA,iBAYC;QAXC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,GAAK,EAAE,CAAC;QAEzB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;aAC/B,SAAS,CAAC,UAAA,IAAI;YACb,KAAI,CAAC,cAAc,GAAG,mBAAmB,CAAC;YAC1C,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;YAEhC,kCAAkC;YAClC,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAA;IACN,CAAC;IA5BH;QAAC,gBAAS,CAAC;YACT,WAAW,EAAE,oDAAoD;SAClE,CAAC;;2BAAA;IA4BF,0BAAC;AAAD,CAAC,AA3BD,IA2BC;AA3BY,2BAAmB,sBA2B/B,CAAA"}
--------------------------------------------------------------------------------
/dist/users/user-edit/user-edit.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | var core_1 = require('@angular/core');
12 | var user_service_1 = require('../../shared/services/user.service');
13 | var router_1 = require('@angular/router');
14 | var UserEditComponent = (function () {
15 | function UserEditComponent(service, route) {
16 | this.service = service;
17 | this.route = route;
18 | this.successMessage = '';
19 | this.errorMessage = '';
20 | }
21 | UserEditComponent.prototype.ngOnInit = function () {
22 | var _this = this;
23 | // grab the user
24 | var id = this.route.snapshot.params['id'];
25 | this.service.getUser(id).subscribe(function (user) { return _this.user = user; });
26 | };
27 | /**
28 | * Update the user
29 | */
30 | UserEditComponent.prototype.updateUser = function () {
31 | var _this = this;
32 | this.successMessage = '';
33 | this.errorMessage = '';
34 | this.service.updateUser(this.user)
35 | .subscribe(function (user) {
36 | _this.successMessage = 'User was updated.';
37 | console.log('user was updated');
38 | }, function (err) {
39 | _this.errorMessage = err;
40 | console.error(err);
41 | });
42 | };
43 | UserEditComponent = __decorate([
44 | core_1.Component({
45 | templateUrl: './app/users/user-edit/user-edit.component.html'
46 | }),
47 | __metadata('design:paramtypes', [user_service_1.UserService, router_1.ActivatedRoute])
48 | ], UserEditComponent);
49 | return UserEditComponent;
50 | }());
51 | exports.UserEditComponent = UserEditComponent;
52 | //# sourceMappingURL=user-edit.component.js.map
--------------------------------------------------------------------------------
/dist/users/user-edit/user-edit.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"user-edit.component.js","sourceRoot":"","sources":["../../../app/users/user-edit/user-edit.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAkC,eAAe,CAAC,CAAA;AAElD,6BAA4B,oCAAoC,CAAC,CAAA;AACjE,uBAA+B,iBAAiB,CAAC,CAAA;AAKjD;IAKE,2BAAoB,OAAoB,EAAU,KAAqB;QAAnD,YAAO,GAAP,OAAO,CAAa;QAAU,UAAK,GAAL,KAAK,CAAgB;QAHvE,mBAAc,GAAW,EAAE,CAAC;QAC5B,iBAAY,GAAW,EAAE,CAAC;IAEiD,CAAC;IAE5E,oCAAQ,GAAR;QAAA,iBAIC;QAHC,gBAAgB;QAChB,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,UAAA,IAAI,IAAI,OAAA,KAAI,CAAC,IAAI,GAAG,IAAI,EAAhB,CAAgB,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,sCAAU,GAAV;QAAA,iBAeC;QAdC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,GAAK,EAAE,CAAC;QAEzB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;aAC/B,SAAS,CACR,UAAA,IAAI;YACF,KAAI,CAAC,cAAc,GAAG,mBAAmB,CAAC;YAC1C,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAClC,CAAC,EACD,UAAA,GAAG;YACD,KAAI,CAAC,YAAY,GAAG,GAAG,CAAC;YACxB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,CACF,CAAC;IACN,CAAC;IAlCH;QAAC,gBAAS,CAAC;YACT,WAAW,EAAE,gDAAgD;SAC9D,CAAC;;yBAAA;IAmCF,wBAAC;AAAD,CAAC,AAlCD,IAkCC;AAlCY,yBAAiB,oBAkC7B,CAAA"}
--------------------------------------------------------------------------------
/dist/users/user-list/user-list.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | var core_1 = require('@angular/core');
12 | var user_service_1 = require('../../shared/services/user.service');
13 | var UserListComponent = (function () {
14 | function UserListComponent(service) {
15 | this.service = service;
16 | }
17 | UserListComponent.prototype.ngOnInit = function () {
18 | var _this = this;
19 | this.service.getUsers()
20 | .subscribe(function (users) { return _this.users = users; });
21 | };
22 | UserListComponent = __decorate([
23 | core_1.Component({
24 | styles: ["\n .user-card { cursor: pointer; } \n "],
25 | templateUrl: './app/users/user-list/user-list.component.html'
26 | }),
27 | __metadata('design:paramtypes', [user_service_1.UserService])
28 | ], UserListComponent);
29 | return UserListComponent;
30 | }());
31 | exports.UserListComponent = UserListComponent;
32 | //# sourceMappingURL=user-list.component.js.map
--------------------------------------------------------------------------------
/dist/users/user-list/user-list.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"user-list.component.js","sourceRoot":"","sources":["../../../app/users/user-list/user-list.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAkC,eAAe,CAAC,CAAA;AAClD,6BAA4B,oCAAoC,CAAC,CAAA;AASjE;IAGE,2BAAoB,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;IAAI,CAAC;IAE7C,oCAAQ,GAAR;QAAA,iBAGC;QAFC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;aACpB,SAAS,CAAC,UAAA,KAAK,IAAI,OAAA,KAAI,CAAC,KAAK,GAAG,KAAK,EAAlB,CAAkB,CAAC,CAAC;IAC5C,CAAC;IAdH;QAAC,gBAAS,CAAC;YACT,MAAM,EAAE,CAAC,4CAER,CAAC;YACF,WAAW,EAAE,gDAAgD;SAC9D,CAAC;;yBAAA;IAWF,wBAAC;AAAD,CAAC,AAVD,IAUC;AAVY,yBAAiB,oBAU7B,CAAA"}
--------------------------------------------------------------------------------
/dist/users/user-single/user-single.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | var core_1 = require('@angular/core');
12 | var router_1 = require('@angular/router');
13 | var user_service_1 = require('../../shared/services/user.service');
14 | var UserSingleComponent = (function () {
15 | function UserSingleComponent(route, router, service) {
16 | this.route = route;
17 | this.router = router;
18 | this.service = service;
19 | }
20 | UserSingleComponent.prototype.ngOnInit = function () {
21 | var _this = this;
22 | // grab the id from the url
23 | var id = this.route.snapshot.params['id'];
24 | // use the userservice to getUser()
25 | this.service.getUser(id)
26 | .subscribe(function (user) { return _this.user = user; });
27 | };
28 | /**
29 | * Delete a user
30 | */
31 | UserSingleComponent.prototype.deleteUser = function () {
32 | var _this = this;
33 | this.service.deleteUser(this.user.id)
34 | .subscribe(function (data) {
35 | console.log('user was deleted');
36 | // route back to the users page
37 | _this.router.navigate(['/users']);
38 | });
39 | };
40 | UserSingleComponent = __decorate([
41 | core_1.Component({
42 | templateUrl: './app/users/user-single/user-single.component.html'
43 | }),
44 | __metadata('design:paramtypes', [router_1.ActivatedRoute, router_1.Router, user_service_1.UserService])
45 | ], UserSingleComponent);
46 | return UserSingleComponent;
47 | }());
48 | exports.UserSingleComponent = UserSingleComponent;
49 | //# sourceMappingURL=user-single.component.js.map
--------------------------------------------------------------------------------
/dist/users/user-single/user-single.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"user-single.component.js","sourceRoot":"","sources":["../../../app/users/user-single/user-single.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAkC,eAAe,CAAC,CAAA;AAClD,uBAAuC,iBAAiB,CAAC,CAAA;AAEzD,6BAA4B,oCAAoC,CAAC,CAAA;AAKjE;IAGE,6BACU,KAAqB,EACrB,MAAc,EACd,OAAoB;QAFpB,UAAK,GAAL,KAAK,CAAgB;QACrB,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAAa;IAC3B,CAAC;IAEJ,sCAAQ,GAAR;QAAA,iBAOC;QANC,2BAA2B;QAC3B,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAE1C,mCAAmC;QACnC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;aACrB,SAAS,CAAC,UAAA,IAAI,IAAI,OAAA,KAAI,CAAC,IAAI,GAAG,IAAI,EAAhB,CAAgB,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,wCAAU,GAAV;QAAA,iBAOC;QANC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;aAClC,SAAS,CAAC,UAAA,IAAI;YACb,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;YAChC,+BAA+B;YAC/B,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC;IA/BH;QAAC,gBAAS,CAAC;YACT,WAAW,EAAE,oDAAoD;SAClE,CAAC;;2BAAA;IA+BF,0BAAC;AAAD,CAAC,AA9BD,IA8BC;AA9BY,2BAAmB,sBA8B/B,CAAA"}
--------------------------------------------------------------------------------
/dist/users/users.component.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
7 | };
8 | var __metadata = (this && this.__metadata) || function (k, v) {
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10 | };
11 | var core_1 = require('@angular/core');
12 | var user_service_1 = require('../shared/services/user.service');
13 | var UsersComponent = (function () {
14 | function UsersComponent(service) {
15 | this.service = service;
16 | this.successMessage = '';
17 | this.errorMessage = '';
18 | }
19 | UsersComponent.prototype.ngOnInit = function () {
20 | var _this = this;
21 | // user has been created
22 | this.service.userCreated$.subscribe(function (user) {
23 | _this.successMessage = user.name + " has been created!";
24 | _this.clearMessages();
25 | });
26 | // user has been deleted
27 | this.service.userDeleted$.subscribe(function () {
28 | _this.successMessage = "The user has been deleted!";
29 | _this.clearMessages();
30 | });
31 | };
32 | /**
33 | * Clear all messages after 5 seconds
34 | */
35 | UsersComponent.prototype.clearMessages = function () {
36 | var _this = this;
37 | setTimeout(function () {
38 | _this.successMessage = '';
39 | _this.errorMessage = '';
40 | }, 5000);
41 | };
42 | UsersComponent = __decorate([
43 | core_1.Component({
44 | selector: 'my-users',
45 | templateUrl: './app/users/users.component.html'
46 | }),
47 | __metadata('design:paramtypes', [user_service_1.UserService])
48 | ], UsersComponent);
49 | return UsersComponent;
50 | }());
51 | exports.UsersComponent = UsersComponent;
52 | //# sourceMappingURL=users.component.js.map
--------------------------------------------------------------------------------
/dist/users/users.component.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"users.component.js","sourceRoot":"","sources":["../../app/users/users.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAkC,eAAe,CAAC,CAAA;AAClD,6BAA4B,iCAAiC,CAAC,CAAA;AAM9D;IAIE,wBAAoB,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;QAHxC,mBAAc,GAAW,EAAE,CAAC;QAC5B,iBAAY,GAAW,EAAE,CAAC;IAEiB,CAAC;IAE5C,iCAAQ,GAAR;QAAA,iBAYC;QAXC,wBAAwB;QACxB,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,UAAA,IAAI;YACtC,KAAI,CAAC,cAAc,GAAM,IAAI,CAAC,IAAI,uBAAoB,CAAC;YACvD,KAAI,CAAC,aAAa,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,wBAAwB;QACxB,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC;YAClC,KAAI,CAAC,cAAc,GAAG,4BAA4B,CAAC;YACnD,KAAI,CAAC,aAAa,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,sCAAa,GAAb;QAAA,iBAKC;QAJC,UAAU,CAAC;YACT,KAAI,CAAC,cAAc,GAAG,EAAE,CAAC;YACzB,KAAI,CAAC,YAAY,GAAK,EAAE,CAAC;QAC3B,CAAC,EAAE,IAAI,CAAC,CAAC;IACX,CAAC;IAhCH;QAAC,gBAAS,CAAC;YACT,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,kCAAkC;SAChD,CAAC;;sBAAA;IA8BF,qBAAC;AAAD,CAAC,AA7BD,IA6BC;AA7BY,sBAAc,iBA6B1B,CAAA"}
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | My Angular App!
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "angular2-starter-basic",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\"",
8 | "lite": "lite-server",
9 | "tsc": "tsc",
10 | "tsc:w": "tsc -w",
11 | "typings": "typings",
12 | "postinstall": "typings install"
13 | },
14 | "keywords": [],
15 | "author": "",
16 | "license": "ISC",
17 | "devDependencies": {
18 | "concurrently": "^3.0.0",
19 | "lite-server": "^2.2.2",
20 | "typescript": "^2.0.3",
21 | "typings": "^1.4.0"
22 | },
23 | "dependencies": {
24 | "@angular/common": "~2.1.1",
25 | "@angular/compiler": "~2.1.1",
26 | "@angular/core": "~2.1.1",
27 |
28 | "@angular/platform-browser": "~2.1.1",
29 | "@angular/platform-browser-dynamic": "~2.1.1",
30 |
31 | "@angular/forms": "~2.1.1",
32 | "@angular/http": "~2.1.1",
33 | "@angular/router": "~3.1.1",
34 | "@angular/upgrade": "~2.1.1",
35 |
36 | "core-js": "^2.4.1",
37 | "reflect-metadata": "^0.1.8",
38 | "rxjs": "5.0.0-beta.12",
39 | "systemjs": "0.19.39",
40 | "zone.js": "^0.6.25"
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/systemjs.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * System configuration for Angular 2 samples
3 | * Adjust as necessary for your application needs.
4 | */
5 | (function(global) {
6 | // map tells the System loader where to look for things
7 | var map = {
8 | 'app': 'dist', // 'dist',
9 | '@angular': 'node_modules/@angular',
10 | 'rxjs': 'node_modules/rxjs'
11 | };
12 | // packages tells the System loader how to load when no filename and/or no extension
13 | var packages = {
14 | 'app': { main: 'main.js', defaultExtension: 'js' },
15 | 'rxjs': { defaultExtension: 'js' }
16 | };
17 | var ngPackageNames = [
18 | 'common',
19 | 'compiler',
20 | 'core',
21 | 'forms',
22 | 'http',
23 | 'platform-browser',
24 | 'platform-browser-dynamic',
25 | 'router'
26 | ];
27 | // Individual files (~300 requests):
28 | function packIndex(pkgName) {
29 | packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
30 | }
31 | // Bundled (~40 requests):
32 | function packUmd(pkgName) {
33 | packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
34 | }
35 | // Most environments should use UMD; some (Karma) need the individual index files
36 | var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
37 | // Add package entries for angular packages
38 | ngPackageNames.forEach(setPackageConfig);
39 | var config = {
40 | map: map,
41 | packages: packages
42 | };
43 | System.config(config);
44 | })(this);
45 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "commonjs",
5 | "moduleResolution": "node",
6 | "sourceMap": true,
7 | "emitDecoratorMetadata": true,
8 | "experimentalDecorators": true,
9 | "removeComments": false,
10 | "noImplicitAny": false,
11 | "outDir": "dist"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/typings.json:
--------------------------------------------------------------------------------
1 | {
2 | "globalDependencies": {
3 | "core-js": "registry:dt/core-js#0.0.0+20160725163759",
4 | "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
5 | "node": "registry:dt/node#6.0.0+20160818175514"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/typings/globals/core-js/index.d.ts:
--------------------------------------------------------------------------------
1 | // Generated by typings
2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/25e18b592470e3dddccc826fde2bb8e7610ef863/core-js/core-js.d.ts
3 | declare type PropertyKey = string | number | symbol;
4 |
5 | // #############################################################################################
6 | // ECMAScript 6: Object & Function
7 | // Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of,
8 | // es6.object.to-string, es6.function.name and es6.function.has-instance.
9 | // #############################################################################################
10 |
11 | interface ObjectConstructor {
12 | /**
13 | * Copy the values of all of the enumerable own properties from one or more source objects to a
14 | * target object. Returns the target object.
15 | * @param target The target object to copy to.
16 | * @param source The source object from which to copy properties.
17 | */
18 | assign(target: T, source: U): T & U;
19 |
20 | /**
21 | * Copy the values of all of the enumerable own properties from one or more source objects to a
22 | * target object. Returns the target object.
23 | * @param target The target object to copy to.
24 | * @param source1 The first source object from which to copy properties.
25 | * @param source2 The second source object from which to copy properties.
26 | */
27 | assign(target: T, source1: U, source2: V): T & U & V;
28 |
29 | /**
30 | * Copy the values of all of the enumerable own properties from one or more source objects to a
31 | * target object. Returns the target object.
32 | * @param target The target object to copy to.
33 | * @param source1 The first source object from which to copy properties.
34 | * @param source2 The second source object from which to copy properties.
35 | * @param source3 The third source object from which to copy properties.
36 | */
37 | assign(target: T, source1: U, source2: V, source3: W): T & U & V & W;
38 |
39 | /**
40 | * Copy the values of all of the enumerable own properties from one or more source objects to a
41 | * target object. Returns the target object.
42 | * @param target The target object to copy to.
43 | * @param sources One or more source objects from which to copy properties
44 | */
45 | assign(target: any, ...sources: any[]): any;
46 |
47 | /**
48 | * Returns true if the values are the same value, false otherwise.
49 | * @param value1 The first value.
50 | * @param value2 The second value.
51 | */
52 | is(value1: any, value2: any): boolean;
53 |
54 | /**
55 | * Sets the prototype of a specified object o to object proto or null. Returns the object o.
56 | * @param o The object to change its prototype.
57 | * @param proto The value of the new prototype or null.
58 | * @remarks Requires `__proto__` support.
59 | */
60 | setPrototypeOf(o: any, proto: any): any;
61 | }
62 |
63 | interface Function {
64 | /**
65 | * Returns the name of the function. Function names are read-only and can not be changed.
66 | */
67 | name: string;
68 |
69 | /**
70 | * Determines if a constructor object recognizes an object as one of the
71 | * constructor’s instances.
72 | * @param value The object to test.
73 | */
74 | [Symbol.hasInstance](value: any): boolean;
75 | }
76 |
77 | // #############################################################################################
78 | // ECMAScript 6: Array
79 | // Modules: es6.array.from, es6.array.of, es6.array.copy-within, es6.array.fill, es6.array.find,
80 | // and es6.array.find-index
81 | // #############################################################################################
82 |
83 | interface Array {
84 | /**
85 | * Returns the value of the first element in the array where predicate is true, and undefined
86 | * otherwise.
87 | * @param predicate find calls predicate once for each element of the array, in ascending
88 | * order, until it finds one where predicate returns true. If such an element is found, find
89 | * immediately returns that element value. Otherwise, find returns undefined.
90 | * @param thisArg If provided, it will be used as the this value for each invocation of
91 | * predicate. If it is not provided, undefined is used instead.
92 | */
93 | find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T;
94 |
95 | /**
96 | * Returns the index of the first element in the array where predicate is true, and undefined
97 | * otherwise.
98 | * @param predicate find calls predicate once for each element of the array, in ascending
99 | * order, until it finds one where predicate returns true. If such an element is found, find
100 | * immediately returns that element value. Otherwise, find returns undefined.
101 | * @param thisArg If provided, it will be used as the this value for each invocation of
102 | * predicate. If it is not provided, undefined is used instead.
103 | */
104 | findIndex(predicate: (value: T) => boolean, thisArg?: any): number;
105 |
106 | /**
107 | * Returns the this object after filling the section identified by start and end with value
108 | * @param value value to fill array section with
109 | * @param start index to start filling the array at. If start is negative, it is treated as
110 | * length+start where length is the length of the array.
111 | * @param end index to stop filling the array at. If end is negative, it is treated as
112 | * length+end.
113 | */
114 | fill(value: T, start?: number, end?: number): T[];
115 |
116 | /**
117 | * Returns the this object after copying a section of the array identified by start and end
118 | * to the same array starting at position target
119 | * @param target If target is negative, it is treated as length+target where length is the
120 | * length of the array.
121 | * @param start If start is negative, it is treated as length+start. If end is negative, it
122 | * is treated as length+end.
123 | * @param end If not specified, length of the this object is used as its default value.
124 | */
125 | copyWithin(target: number, start: number, end?: number): T[];
126 |
127 | [Symbol.unscopables]: any;
128 | }
129 |
130 | interface ArrayConstructor {
131 | /**
132 | * Creates an array from an array-like object.
133 | * @param arrayLike An array-like object to convert to an array.
134 | * @param mapfn A mapping function to call on every element of the array.
135 | * @param thisArg Value of 'this' used to invoke the mapfn.
136 | */
137 | from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array;
138 |
139 | /**
140 | * Creates an array from an iterable object.
141 | * @param iterable An iterable object to convert to an array.
142 | * @param mapfn A mapping function to call on every element of the array.
143 | * @param thisArg Value of 'this' used to invoke the mapfn.
144 | */
145 | from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array;
146 |
147 | /**
148 | * Creates an array from an array-like object.
149 | * @param arrayLike An array-like object to convert to an array.
150 | */
151 | from(arrayLike: ArrayLike): Array;
152 |
153 | /**
154 | * Creates an array from an iterable object.
155 | * @param iterable An iterable object to convert to an array.
156 | */
157 | from(iterable: Iterable): Array;
158 |
159 | /**
160 | * Returns a new array from a set of elements.
161 | * @param items A set of elements to include in the new array object.
162 | */
163 | of(...items: T[]): Array;
164 | }
165 |
166 | // #############################################################################################
167 | // ECMAScript 6: String & RegExp
168 | // Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at,
169 | // es6.string.ends-with, es6.string.includes, es6.string.repeat,
170 | // es6.string.starts-with, and es6.regexp
171 | // #############################################################################################
172 |
173 | interface String {
174 | /**
175 | * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
176 | * value of the UTF-16 encoded code point starting at the string element at position pos in
177 | * the String resulting from converting this object to a String.
178 | * If there is no element at that position, the result is undefined.
179 | * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
180 | */
181 | codePointAt(pos: number): number;
182 |
183 | /**
184 | * Returns true if searchString appears as a substring of the result of converting this
185 | * object to a String, at one or more positions that are
186 | * greater than or equal to position; otherwise, returns false.
187 | * @param searchString search string
188 | * @param position If position is undefined, 0 is assumed, so as to search all of the String.
189 | */
190 | includes(searchString: string, position?: number): boolean;
191 |
192 | /**
193 | * Returns true if the sequence of elements of searchString converted to a String is the
194 | * same as the corresponding elements of this object (converted to a String) starting at
195 | * endPosition – length(this). Otherwise returns false.
196 | */
197 | endsWith(searchString: string, endPosition?: number): boolean;
198 |
199 | /**
200 | * Returns a String value that is made from count copies appended together. If count is 0,
201 | * T is the empty String is returned.
202 | * @param count number of copies to append
203 | */
204 | repeat(count: number): string;
205 |
206 | /**
207 | * Returns true if the sequence of elements of searchString converted to a String is the
208 | * same as the corresponding elements of this object (converted to a String) starting at
209 | * position. Otherwise returns false.
210 | */
211 | startsWith(searchString: string, position?: number): boolean;
212 | }
213 |
214 | interface StringConstructor {
215 | /**
216 | * Return the String value whose elements are, in order, the elements in the List elements.
217 | * If length is 0, the empty string is returned.
218 | */
219 | fromCodePoint(...codePoints: number[]): string;
220 |
221 | /**
222 | * String.raw is intended for use as a tag function of a Tagged Template String. When called
223 | * as such the first argument will be a well formed template call site object and the rest
224 | * parameter will contain the substitution values.
225 | * @param template A well-formed template string call site representation.
226 | * @param substitutions A set of substitution values.
227 | */
228 | raw(template: TemplateStringsArray, ...substitutions: any[]): string;
229 | }
230 |
231 | interface RegExp {
232 | /**
233 | * Returns a string indicating the flags of the regular expression in question. This field is read-only.
234 | * The characters in this string are sequenced and concatenated in the following order:
235 | *
236 | * - "g" for global
237 | * - "i" for ignoreCase
238 | * - "m" for multiline
239 | * - "u" for unicode
240 | * - "y" for sticky
241 | *
242 | * If no flags are set, the value is the empty string.
243 | */
244 | flags: string;
245 | }
246 |
247 | // #############################################################################################
248 | // ECMAScript 6: Number & Math
249 | // Modules: es6.number.constructor, es6.number.statics, and es6.math
250 | // #############################################################################################
251 |
252 | interface NumberConstructor {
253 | /**
254 | * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
255 | * that is representable as a Number value, which is approximately:
256 | * 2.2204460492503130808472633361816 x 10−16.
257 | */
258 | EPSILON: number;
259 |
260 | /**
261 | * Returns true if passed value is finite.
262 | * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
263 | * number. Only finite values of the type number, result in true.
264 | * @param number A numeric value.
265 | */
266 | isFinite(number: number): boolean;
267 |
268 | /**
269 | * Returns true if the value passed is an integer, false otherwise.
270 | * @param number A numeric value.
271 | */
272 | isInteger(number: number): boolean;
273 |
274 | /**
275 | * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
276 | * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
277 | * to a number. Only values of the type number, that are also NaN, result in true.
278 | * @param number A numeric value.
279 | */
280 | isNaN(number: number): boolean;
281 |
282 | /**
283 | * Returns true if the value passed is a safe integer.
284 | * @param number A numeric value.
285 | */
286 | isSafeInteger(number: number): boolean;
287 |
288 | /**
289 | * The value of the largest integer n such that n and n + 1 are both exactly representable as
290 | * a Number value.
291 | * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1.
292 | */
293 | MAX_SAFE_INTEGER: number;
294 |
295 | /**
296 | * The value of the smallest integer n such that n and n − 1 are both exactly representable as
297 | * a Number value.
298 | * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).
299 | */
300 | MIN_SAFE_INTEGER: number;
301 |
302 | /**
303 | * Converts a string to a floating-point number.
304 | * @param string A string that contains a floating-point number.
305 | */
306 | parseFloat(string: string): number;
307 |
308 | /**
309 | * Converts A string to an integer.
310 | * @param s A string to convert into a number.
311 | * @param radix A value between 2 and 36 that specifies the base of the number in numString.
312 | * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
313 | * All other strings are considered decimal.
314 | */
315 | parseInt(string: string, radix?: number): number;
316 | }
317 |
318 | interface Math {
319 | /**
320 | * Returns the number of leading zero bits in the 32-bit binary representation of a number.
321 | * @param x A numeric expression.
322 | */
323 | clz32(x: number): number;
324 |
325 | /**
326 | * Returns the result of 32-bit multiplication of two numbers.
327 | * @param x First number
328 | * @param y Second number
329 | */
330 | imul(x: number, y: number): number;
331 |
332 | /**
333 | * Returns the sign of the x, indicating whether x is positive, negative or zero.
334 | * @param x The numeric expression to test
335 | */
336 | sign(x: number): number;
337 |
338 | /**
339 | * Returns the base 10 logarithm of a number.
340 | * @param x A numeric expression.
341 | */
342 | log10(x: number): number;
343 |
344 | /**
345 | * Returns the base 2 logarithm of a number.
346 | * @param x A numeric expression.
347 | */
348 | log2(x: number): number;
349 |
350 | /**
351 | * Returns the natural logarithm of 1 + x.
352 | * @param x A numeric expression.
353 | */
354 | log1p(x: number): number;
355 |
356 | /**
357 | * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
358 | * the natural logarithms).
359 | * @param x A numeric expression.
360 | */
361 | expm1(x: number): number;
362 |
363 | /**
364 | * Returns the hyperbolic cosine of a number.
365 | * @param x A numeric expression that contains an angle measured in radians.
366 | */
367 | cosh(x: number): number;
368 |
369 | /**
370 | * Returns the hyperbolic sine of a number.
371 | * @param x A numeric expression that contains an angle measured in radians.
372 | */
373 | sinh(x: number): number;
374 |
375 | /**
376 | * Returns the hyperbolic tangent of a number.
377 | * @param x A numeric expression that contains an angle measured in radians.
378 | */
379 | tanh(x: number): number;
380 |
381 | /**
382 | * Returns the inverse hyperbolic cosine of a number.
383 | * @param x A numeric expression that contains an angle measured in radians.
384 | */
385 | acosh(x: number): number;
386 |
387 | /**
388 | * Returns the inverse hyperbolic sine of a number.
389 | * @param x A numeric expression that contains an angle measured in radians.
390 | */
391 | asinh(x: number): number;
392 |
393 | /**
394 | * Returns the inverse hyperbolic tangent of a number.
395 | * @param x A numeric expression that contains an angle measured in radians.
396 | */
397 | atanh(x: number): number;
398 |
399 | /**
400 | * Returns the square root of the sum of squares of its arguments.
401 | * @param values Values to compute the square root for.
402 | * If no arguments are passed, the result is +0.
403 | * If there is only one argument, the result is the absolute value.
404 | * If any argument is +Infinity or -Infinity, the result is +Infinity.
405 | * If any argument is NaN, the result is NaN.
406 | * If all arguments are either +0 or −0, the result is +0.
407 | */
408 | hypot(...values: number[]): number;
409 |
410 | /**
411 | * Returns the integral part of the a numeric expression, x, removing any fractional digits.
412 | * If x is already an integer, the result is x.
413 | * @param x A numeric expression.
414 | */
415 | trunc(x: number): number;
416 |
417 | /**
418 | * Returns the nearest single precision float representation of a number.
419 | * @param x A numeric expression.
420 | */
421 | fround(x: number): number;
422 |
423 | /**
424 | * Returns an implementation-dependent approximation to the cube root of number.
425 | * @param x A numeric expression.
426 | */
427 | cbrt(x: number): number;
428 | }
429 |
430 | // #############################################################################################
431 | // ECMAScript 6: Symbols
432 | // Modules: es6.symbol
433 | // #############################################################################################
434 |
435 | interface Symbol {
436 | /** Returns a string representation of an object. */
437 | toString(): string;
438 |
439 | [Symbol.toStringTag]: string;
440 | }
441 |
442 | interface SymbolConstructor {
443 | /**
444 | * A reference to the prototype.
445 | */
446 | prototype: Symbol;
447 |
448 | /**
449 | * Returns a new unique Symbol value.
450 | * @param description Description of the new Symbol object.
451 | */
452 | (description?: string|number): symbol;
453 |
454 | /**
455 | * Returns a Symbol object from the global symbol registry matching the given key if found.
456 | * Otherwise, returns a new symbol with this key.
457 | * @param key key to search for.
458 | */
459 | for(key: string): symbol;
460 |
461 | /**
462 | * Returns a key from the global symbol registry matching the given Symbol if found.
463 | * Otherwise, returns a undefined.
464 | * @param sym Symbol to find the key for.
465 | */
466 | keyFor(sym: symbol): string;
467 |
468 | // Well-known Symbols
469 |
470 | /**
471 | * A method that determines if a constructor object recognizes an object as one of the
472 | * constructor’s instances. Called by the semantics of the instanceof operator.
473 | */
474 | hasInstance: symbol;
475 |
476 | /**
477 | * A Boolean value that if true indicates that an object should flatten to its array elements
478 | * by Array.prototype.concat.
479 | */
480 | isConcatSpreadable: symbol;
481 |
482 | /**
483 | * A method that returns the default iterator for an object. Called by the semantics of the
484 | * for-of statement.
485 | */
486 | iterator: symbol;
487 |
488 | /**
489 | * A regular expression method that matches the regular expression against a string. Called
490 | * by the String.prototype.match method.
491 | */
492 | match: symbol;
493 |
494 | /**
495 | * A regular expression method that replaces matched substrings of a string. Called by the
496 | * String.prototype.replace method.
497 | */
498 | replace: symbol;
499 |
500 | /**
501 | * A regular expression method that returns the index within a string that matches the
502 | * regular expression. Called by the String.prototype.search method.
503 | */
504 | search: symbol;
505 |
506 | /**
507 | * A function valued property that is the constructor function that is used to create
508 | * derived objects.
509 | */
510 | species: symbol;
511 |
512 | /**
513 | * A regular expression method that splits a string at the indices that match the regular
514 | * expression. Called by the String.prototype.split method.
515 | */
516 | split: symbol;
517 |
518 | /**
519 | * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
520 | * abstract operation.
521 | */
522 | toPrimitive: symbol;
523 |
524 | /**
525 | * A String value that is used in the creation of the default string description of an object.
526 | * Called by the built-in method Object.prototype.toString.
527 | */
528 | toStringTag: symbol;
529 |
530 | /**
531 | * An Object whose own property names are property names that are excluded from the with
532 | * environment bindings of the associated objects.
533 | */
534 | unscopables: symbol;
535 |
536 | /**
537 | * Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
538 | */
539 | useSimple(): void;
540 |
541 | /**
542 | * Non-standard. Use setter mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
543 | */
544 | userSetter(): void;
545 | }
546 |
547 | declare var Symbol: SymbolConstructor;
548 |
549 | interface Object {
550 | /**
551 | * Determines whether an object has a property with the specified name.
552 | * @param v A property name.
553 | */
554 | hasOwnProperty(v: PropertyKey): boolean;
555 |
556 | /**
557 | * Determines whether a specified property is enumerable.
558 | * @param v A property name.
559 | */
560 | propertyIsEnumerable(v: PropertyKey): boolean;
561 | }
562 |
563 | interface ObjectConstructor {
564 | /**
565 | * Returns an array of all symbol properties found directly on object o.
566 | * @param o Object to retrieve the symbols from.
567 | */
568 | getOwnPropertySymbols(o: any): symbol[];
569 |
570 | /**
571 | * Gets the own property descriptor of the specified object.
572 | * An own property descriptor is one that is defined directly on the object and is not
573 | * inherited from the object's prototype.
574 | * @param o Object that contains the property.
575 | * @param p Name of the property.
576 | */
577 | getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor;
578 |
579 | /**
580 | * Adds a property to an object, or modifies attributes of an existing property.
581 | * @param o Object on which to add or modify the property. This can be a native JavaScript
582 | * object (that is, a user-defined object or a built in object) or a DOM object.
583 | * @param p The property name.
584 | * @param attributes Descriptor for the property. It can be for a data property or an accessor
585 | * property.
586 | */
587 | defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any;
588 | }
589 |
590 | interface Math {
591 | [Symbol.toStringTag]: string;
592 | }
593 |
594 | interface JSON {
595 | [Symbol.toStringTag]: string;
596 | }
597 |
598 | // #############################################################################################
599 | // ECMAScript 6: Collections
600 | // Modules: es6.map, es6.set, es6.weak-map, and es6.weak-set
601 | // #############################################################################################
602 |
603 | interface Map {
604 | clear(): void;
605 | delete(key: K): boolean;
606 | forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void;
607 | get(key: K): V;
608 | has(key: K): boolean;
609 | set(key: K, value?: V): Map;
610 | size: number;
611 | }
612 |
613 | interface MapConstructor {
614 | new (): Map;
615 | new (iterable: Iterable<[K, V]>): Map;
616 | prototype: Map;
617 | }
618 |
619 | declare var Map: MapConstructor;
620 |
621 | interface Set {
622 | add(value: T): Set;
623 | clear(): void;
624 | delete(value: T): boolean;
625 | forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void;
626 | has(value: T): boolean;
627 | size: number;
628 | }
629 |
630 | interface SetConstructor {
631 | new (): Set;
632 | new (iterable: Iterable): Set;
633 | prototype: Set;
634 | }
635 |
636 | declare var Set: SetConstructor;
637 |
638 | interface WeakMap {
639 | delete(key: K): boolean;
640 | get(key: K): V;
641 | has(key: K): boolean;
642 | set(key: K, value?: V): WeakMap;
643 | }
644 |
645 | interface WeakMapConstructor {
646 | new (): WeakMap;
647 | new (iterable: Iterable<[K, V]>): WeakMap;
648 | prototype: WeakMap;
649 | }
650 |
651 | declare var WeakMap: WeakMapConstructor;
652 |
653 | interface WeakSet {
654 | add(value: T): WeakSet;
655 | delete(value: T): boolean;
656 | has(value: T): boolean;
657 | }
658 |
659 | interface WeakSetConstructor {
660 | new (): WeakSet;
661 | new (iterable: Iterable): WeakSet;
662 | prototype: WeakSet;
663 | }
664 |
665 | declare var WeakSet: WeakSetConstructor;
666 |
667 | // #############################################################################################
668 | // ECMAScript 6: Iterators
669 | // Modules: es6.string.iterator, es6.array.iterator, es6.map, es6.set, web.dom.iterable
670 | // #############################################################################################
671 |
672 | interface IteratorResult {
673 | done: boolean;
674 | value?: T;
675 | }
676 |
677 | interface Iterator {
678 | next(value?: any): IteratorResult;
679 | return?(value?: any): IteratorResult;
680 | throw?(e?: any): IteratorResult;
681 | }
682 |
683 | interface Iterable {
684 | [Symbol.iterator](): Iterator;
685 | }
686 |
687 | interface IterableIterator extends Iterator {
688 | [Symbol.iterator](): IterableIterator;
689 | }
690 |
691 | interface String {
692 | /** Iterator */
693 | [Symbol.iterator](): IterableIterator;
694 | }
695 |
696 | interface Array {
697 | /** Iterator */
698 | [Symbol.iterator](): IterableIterator;
699 |
700 | /**
701 | * Returns an array of key, value pairs for every entry in the array
702 | */
703 | entries(): IterableIterator<[number, T]>;
704 |
705 | /**
706 | * Returns an list of keys in the array
707 | */
708 | keys(): IterableIterator;
709 |
710 | /**
711 | * Returns an list of values in the array
712 | */
713 | values(): IterableIterator;
714 | }
715 |
716 | interface Map {
717 | entries(): IterableIterator<[K, V]>;
718 | keys(): IterableIterator;
719 | values(): IterableIterator;
720 | [Symbol.iterator](): IterableIterator<[K, V]>;
721 | }
722 |
723 | interface Set {
724 | entries(): IterableIterator<[T, T]>;
725 | keys(): IterableIterator;
726 | values(): IterableIterator;
727 | [Symbol.iterator](): IterableIterator;
728 | }
729 |
730 | interface NodeList {
731 | [Symbol.iterator](): IterableIterator;
732 | }
733 |
734 | interface $for extends IterableIterator {
735 | of(callbackfn: (value: T, key: any) => void, thisArg?: any): void;
736 | array(): T[];
737 | array(callbackfn: (value: T, key: any) => U, thisArg?: any): U[];
738 | filter(callbackfn: (value: T, key: any) => boolean, thisArg?: any): $for;
739 | map(callbackfn: (value: T, key: any) => U, thisArg?: any): $for;
740 | }
741 |
742 | declare function $for(iterable: Iterable): $for;
743 |
744 | // #############################################################################################
745 | // ECMAScript 6: Promises
746 | // Modules: es6.promise
747 | // #############################################################################################
748 |
749 | interface PromiseLike {
750 | /**
751 | * Attaches callbacks for the resolution and/or rejection of the Promise.
752 | * @param onfulfilled The callback to execute when the Promise is resolved.
753 | * @param onrejected The callback to execute when the Promise is rejected.
754 | * @returns A Promise for the completion of which ever callback is executed.
755 | */
756 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike;
757 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike;
758 | }
759 |
760 | /**
761 | * Represents the completion of an asynchronous operation
762 | */
763 | interface Promise {
764 | /**
765 | * Attaches callbacks for the resolution and/or rejection of the Promise.
766 | * @param onfulfilled The callback to execute when the Promise is resolved.
767 | * @param onrejected The callback to execute when the Promise is rejected.
768 | * @returns A Promise for the completion of which ever callback is executed.
769 | */
770 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise;
771 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise;
772 |
773 | /**
774 | * Attaches a callback for only the rejection of the Promise.
775 | * @param onrejected The callback to execute when the Promise is rejected.
776 | * @returns A Promise for the completion of the callback.
777 | */
778 | catch(onrejected?: (reason: any) => T | PromiseLike): Promise;
779 | catch(onrejected?: (reason: any) => void): Promise;
780 | }
781 |
782 | interface PromiseConstructor {
783 | /**
784 | * A reference to the prototype.
785 | */
786 | prototype: Promise;
787 |
788 | /**
789 | * Creates a new Promise.
790 | * @param executor A callback used to initialize the promise. This callback is passed two arguments:
791 | * a resolve callback used resolve the promise with a value or the result of another promise,
792 | * and a reject callback used to reject the promise with a provided reason or error.
793 | */
794 | new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise;
795 |
796 | /**
797 | * Creates a Promise that is resolved with an array of results when all of the provided Promises
798 | * resolve, or rejected when any Promise is rejected.
799 | * @param values An array of Promises.
800 | * @returns A new Promise.
801 | */
802 | all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
803 | all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
804 | all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
805 | all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
806 | all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>;
807 | all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>;
808 | all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>;
809 | all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>;
810 | all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>;
811 | all(values: Iterable>): Promise;
812 |
813 | /**
814 | * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
815 | * or rejected.
816 | * @param values An array of Promises.
817 | * @returns A new Promise.
818 | */
819 | race(values: Iterable>): Promise;
820 |
821 | /**
822 | * Creates a new rejected promise for the provided reason.
823 | * @param reason The reason the promise was rejected.
824 | * @returns A new rejected Promise.
825 | */
826 | reject(reason: any): Promise;
827 |
828 | /**
829 | * Creates a new rejected promise for the provided reason.
830 | * @param reason The reason the promise was rejected.
831 | * @returns A new rejected Promise.
832 | */
833 | reject(reason: any): Promise;
834 |
835 | /**
836 | * Creates a new resolved promise for the provided value.
837 | * @param value A promise.
838 | * @returns A promise whose internal state matches the provided promise.
839 | */
840 | resolve(value: T | PromiseLike): Promise;
841 |
842 | /**
843 | * Creates a new resolved promise .
844 | * @returns A resolved promise.
845 | */
846 | resolve(): Promise;
847 | }
848 |
849 | declare var Promise: PromiseConstructor;
850 |
851 | // #############################################################################################
852 | // ECMAScript 6: Reflect
853 | // Modules: es6.reflect
854 | // #############################################################################################
855 |
856 | declare namespace Reflect {
857 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any;
858 | function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any;
859 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
860 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
861 | function enumerate(target: any): IterableIterator;
862 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
863 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
864 | function getPrototypeOf(target: any): any;
865 | function has(target: any, propertyKey: PropertyKey): boolean;
866 | function isExtensible(target: any): boolean;
867 | function ownKeys(target: any): Array;
868 | function preventExtensions(target: any): boolean;
869 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
870 | function setPrototypeOf(target: any, proto: any): boolean;
871 | }
872 |
873 | // #############################################################################################
874 | // ECMAScript 7
875 | // Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad,
876 | // es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape,
877 | // es7.map.to-json, and es7.set.to-json
878 | // #############################################################################################
879 |
880 | interface Array {
881 | includes(value: T, fromIndex?: number): boolean;
882 | }
883 |
884 | interface String {
885 | at(index: number): string;
886 | lpad(length: number, fillStr?: string): string;
887 | rpad(length: number, fillStr?: string): string;
888 | }
889 |
890 | interface ObjectConstructor {
891 | values(object: any): any[];
892 | entries(object: any): [string, any][];
893 | getOwnPropertyDescriptors(object: any): PropertyDescriptorMap;
894 | }
895 |
896 | interface RegExpConstructor {
897 | escape(str: string): string;
898 | }
899 |
900 | interface Map {
901 | toJSON(): any;
902 | }
903 |
904 | interface Set {
905 | toJSON(): any;
906 | }
907 |
908 | // #############################################################################################
909 | // Mozilla JavaScript: Array generics
910 | // Modules: js.array.statics
911 | // #############################################################################################
912 |
913 | interface ArrayConstructor {
914 | /**
915 | * Appends new elements to an array, and returns the new length of the array.
916 | * @param items New elements of the Array.
917 | */
918 | push(array: ArrayLike, ...items: T[]): number;
919 | /**
920 | * Removes the last element from an array and returns it.
921 | */
922 | pop(array: ArrayLike): T;
923 | /**
924 | * Combines two or more arrays.
925 | * @param items Additional items to add to the end of array1.
926 | */
927 | concat(array: ArrayLike, ...items: (T[]| T)[]): T[];
928 | /**
929 | * Adds all the elements of an array separated by the specified separator string.
930 | * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
931 | */
932 | join(array: ArrayLike, separator?: string): string;
933 | /**
934 | * Reverses the elements in an Array.
935 | */
936 | reverse(array: ArrayLike): T[];
937 | /**
938 | * Removes the first element from an array and returns it.
939 | */
940 | shift(array: ArrayLike): T;
941 | /**
942 | * Returns a section of an array.
943 | * @param start The beginning of the specified portion of the array.
944 | * @param end The end of the specified portion of the array.
945 | */
946 | slice(array: ArrayLike, start?: number, end?: number): T[];
947 |
948 | /**
949 | * Sorts an array.
950 | * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.
951 | */
952 | sort(array: ArrayLike, compareFn?: (a: T, b: T) => number): T[];
953 |
954 | /**
955 | * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
956 | * @param start The zero-based location in the array from which to start removing elements.
957 | */
958 | splice(array: ArrayLike, start: number): T[];
959 |
960 | /**
961 | * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
962 | * @param start The zero-based location in the array from which to start removing elements.
963 | * @param deleteCount The number of elements to remove.
964 | * @param items Elements to insert into the array in place of the deleted elements.
965 | */
966 | splice(array: ArrayLike, start: number, deleteCount: number, ...items: T[]): T[];
967 |
968 | /**
969 | * Inserts new elements at the start of an array.
970 | * @param items Elements to insert at the start of the Array.
971 | */
972 | unshift(array: ArrayLike, ...items: T[]): number;
973 |
974 | /**
975 | * Returns the index of the first occurrence of a value in an array.
976 | * @param searchElement The value to locate in the array.
977 | * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
978 | */
979 | indexOf(array: ArrayLike, searchElement: T, fromIndex?: number): number;
980 |
981 | /**
982 | * Returns the index of the last occurrence of a specified value in an array.
983 | * @param searchElement The value to locate in the array.
984 | * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.
985 | */
986 | lastIndexOf(array: ArrayLike, earchElement: T, fromIndex?: number): number;
987 |
988 | /**
989 | * Determines whether all the members of an array satisfy the specified test.
990 | * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
991 | * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
992 | */
993 | every(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
994 |
995 | /**
996 | * Determines whether the specified callback function returns true for any element of an array.
997 | * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
998 | * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
999 | */
1000 | some(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
1001 |
1002 | /**
1003 | * Performs the specified action for each element in an array.
1004 | * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
1005 | * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
1006 | */
1007 | forEach(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
1008 |
1009 | /**
1010 | * Calls a defined callback function on each element of an array, and returns an array that contains the results.
1011 | * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
1012 | * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
1013 | */
1014 | map(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
1015 |
1016 | /**
1017 | * Returns the elements of an array that meet the condition specified in a callback function.
1018 | * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
1019 | * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
1020 | */
1021 | filter(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
1022 |
1023 | /**
1024 | * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
1025 | * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
1026 | * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
1027 | */
1028 | reduce(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
1029 |
1030 | /**
1031 | * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
1032 | * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
1033 | * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
1034 | */
1035 | reduce(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
1036 |
1037 | /**
1038 | * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
1039 | * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
1040 | * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
1041 | */
1042 | reduceRight(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
1043 |
1044 | /**
1045 | * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
1046 | * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
1047 | * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
1048 | */
1049 | reduceRight(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
1050 |
1051 | /**
1052 | * Returns an array of key, value pairs for every entry in the array
1053 | */
1054 | entries(array: ArrayLike): IterableIterator<[number, T]>;
1055 |
1056 | /**
1057 | * Returns an list of keys in the array
1058 | */
1059 | keys(array: ArrayLike): IterableIterator;
1060 |
1061 | /**
1062 | * Returns an list of values in the array
1063 | */
1064 | values(array: ArrayLike): IterableIterator;
1065 |
1066 | /**
1067 | * Returns the value of the first element in the array where predicate is true, and undefined
1068 | * otherwise.
1069 | * @param predicate find calls predicate once for each element of the array, in ascending
1070 | * order, until it finds one where predicate returns true. If such an element is found, find
1071 | * immediately returns that element value. Otherwise, find returns undefined.
1072 | * @param thisArg If provided, it will be used as the this value for each invocation of
1073 | * predicate. If it is not provided, undefined is used instead.
1074 | */
1075 | find(array: ArrayLike, predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T;
1076 |
1077 | /**
1078 | * Returns the index of the first element in the array where predicate is true, and undefined
1079 | * otherwise.
1080 | * @param predicate find calls predicate once for each element of the array, in ascending
1081 | * order, until it finds one where predicate returns true. If such an element is found, find
1082 | * immediately returns that element value. Otherwise, find returns undefined.
1083 | * @param thisArg If provided, it will be used as the this value for each invocation of
1084 | * predicate. If it is not provided, undefined is used instead.
1085 | */
1086 | findIndex(array: ArrayLike, predicate: (value: T) => boolean, thisArg?: any): number;
1087 |
1088 | /**
1089 | * Returns the this object after filling the section identified by start and end with value
1090 | * @param value value to fill array section with
1091 | * @param start index to start filling the array at. If start is negative, it is treated as
1092 | * length+start where length is the length of the array.
1093 | * @param end index to stop filling the array at. If end is negative, it is treated as
1094 | * length+end.
1095 | */
1096 | fill(array: ArrayLike, value: T, start?: number, end?: number): T[];
1097 |
1098 | /**
1099 | * Returns the this object after copying a section of the array identified by start and end
1100 | * to the same array starting at position target
1101 | * @param target If target is negative, it is treated as length+target where length is the
1102 | * length of the array.
1103 | * @param start If start is negative, it is treated as length+start. If end is negative, it
1104 | * is treated as length+end.
1105 | * @param end If not specified, length of the this object is used as its default value.
1106 | */
1107 | copyWithin