Skip to content

Commit

Permalink
fix($browser): Removed project depencency on lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
akserg committed May 16, 2016
1 parent 9c4b1cd commit 632bf54
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 53 deletions.
32 changes: 18 additions & 14 deletions bundles/ng2-toasty.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
System.registerDynamic("src/toasty.container", ["@angular/core", "@angular/common", "lodash", "./toasty.config", "./toasty.service", "./toasty.component"], true, function($__require, exports, module) {
System.registerDynamic("src/toasty.container", ["@angular/core", "@angular/common", "@angular/common/src/facade/lang", "./toasty.config", "./toasty.service", "./toasty.component"], true, function($__require, exports, module) {
"use strict";
;
var define,
global = this,
Expand All @@ -21,7 +22,7 @@ System.registerDynamic("src/toasty.container", ["@angular/core", "@angular/commo
};
var core_1 = $__require('@angular/core');
var common_1 = $__require('@angular/common');
var lodash_1 = $__require('lodash');
var lang_1 = $__require('@angular/common/src/facade/lang');
var toasty_config_1 = $__require('./toasty.config');
var toasty_service_1 = $__require('./toasty.service');
var toasty_component_1 = $__require('./toasty.component');
Expand Down Expand Up @@ -69,7 +70,7 @@ System.registerDynamic("src/toasty.container", ["@angular/core", "@angular/commo
if (id) {
this.toasts.forEach(function(value, key) {
if (value.id === id) {
if (value.onRemove && lodash_1.isFunction(value.onRemove))
if (value.onRemove && lang_1.isFunction(value.onRemove))
value.onRemove.call(_this, value);
_this.toasts.splice(key, 1);
}
Expand All @@ -81,7 +82,7 @@ System.registerDynamic("src/toasty.container", ["@angular/core", "@angular/commo
Toasty.prototype.clearAll = function() {
var _this = this;
this.toasts.forEach(function(value, key) {
if (value.onRemove && lodash_1.isFunction(value.onRemove))
if (value.onRemove && lang_1.isFunction(value.onRemove))
value.onRemove.call(_this, value);
});
this.toasts = [];
Expand All @@ -102,12 +103,13 @@ System.registerDynamic("src/toasty.container", ["@angular/core", "@angular/commo
template: "\n <div id=\"toasty\" [ngClass]=\"[position]\">\n <ng2-toast *ngFor=\"let toast of toasts\" [toast]=\"toast\" (closeToast)=\"closeToast(toast)\"></ng2-toast>\n </div>"
}), __metadata('design:paramtypes', [toasty_config_1.ToastyConfig, toasty_service_1.ToastyService])], Toasty);
return Toasty;
})();
}());
exports.Toasty = Toasty;
return module.exports;
});

System.registerDynamic("src/toasty.component", ["@angular/core", "@angular/common"], true, function($__require, exports, module) {
"use strict";
;
var define,
global = this,
Expand Down Expand Up @@ -146,12 +148,13 @@ System.registerDynamic("src/toasty.component", ["@angular/core", "@angular/commo
template: "\n <div class=\"toast\" [ngClass]=\"[toast.type, toast.theme]\">\n <div *ngIf=\"toast.showClose\" class=\"close-button\" (click)=\"close($event)\"></div>\n <div *ngIf=\"toast.title || toast.msg\" class=\"toast-text\">\n <span *ngIf=\"toast.title\" class=\"toast-title\">{{toast.title}}</span>\n <br *ngIf=\"toast.title && toast.msg\" />\n <span *ngIf=\"toast.msg\" class=\"toast-msg\">{{toast.msg}}</span>\n </div>\n </div>"
}), __metadata('design:paramtypes', [])], Toast);
return Toast;
})();
}());
exports.Toast = Toast;
return module.exports;
});

System.registerDynamic("src/toasty.config", ["@angular/core"], true, function($__require, exports, module) {
"use strict";
;
var define,
global = this,
Expand Down Expand Up @@ -183,12 +186,13 @@ System.registerDynamic("src/toasty.config", ["@angular/core"], true, function($_
}
ToastyConfig = __decorate([core_1.Injectable(), __metadata('design:paramtypes', [])], ToastyConfig);
return ToastyConfig;
})();
}());
exports.ToastyConfig = ToastyConfig;
return module.exports;
});

System.registerDynamic("src/toasty.service", ["@angular/core", "lodash", "rxjs/Observable", "./toasty.config"], true, function($__require, exports, module) {
System.registerDynamic("src/toasty.service", ["@angular/core", "@angular/common/src/facade/lang", "rxjs/Observable", "./toasty.config"], true, function($__require, exports, module) {
"use strict";
;
var define,
global = this,
Expand All @@ -210,7 +214,7 @@ System.registerDynamic("src/toasty.service", ["@angular/core", "lodash", "rxjs/O
return Reflect.metadata(k, v);
};
var core_1 = $__require('@angular/core');
var lodash_1 = $__require('lodash');
var lang_1 = $__require('@angular/common/src/facade/lang');
var Observable_1 = $__require('rxjs/Observable');
var toasty_config_1 = $__require('./toasty.config');
var ToastyService = (function() {
Expand Down Expand Up @@ -251,7 +255,7 @@ System.registerDynamic("src/toasty.service", ["@angular/core", "lodash", "rxjs/O
};
ToastyService.prototype.add = function(options, type) {
var toastyOptions;
if (lodash_1.isString(options) && options !== '' || lodash_1.isNumber(options)) {
if (lang_1.isString(options) && options !== '' || lang_1.isNumber(options)) {
toastyOptions = {title: options.toString()};
} else {
toastyOptions = options;
Expand All @@ -275,8 +279,8 @@ System.registerDynamic("src/toasty.service", ["@angular/core", "lodash", "rxjs/O
showClose: showClose,
type: 'toasty-type-' + type,
theme: 'toasty-theme-' + theme,
onAdd: toastyOptions.onAdd && lodash_1.isFunction(toastyOptions.onAdd) ? toastyOptions.onAdd : null,
onRemove: toastyOptions.onRemove && lodash_1.isFunction(toastyOptions.onRemove) ? toastyOptions.onRemove : null
onAdd: toastyOptions.onAdd && lang_1.isFunction(toastyOptions.onAdd) ? toastyOptions.onAdd : null,
onRemove: toastyOptions.onRemove && lang_1.isFunction(toastyOptions.onRemove) ? toastyOptions.onRemove : null
};
if (toastyOptions.timeout) {
toast.timeout = toastyOptions.timeout || this.config.timeout;
Expand All @@ -285,7 +289,7 @@ System.registerDynamic("src/toasty.service", ["@angular/core", "lodash", "rxjs/O
}
try {
this.toastsSubscriber.next(toast);
if (toastyOptions.onAdd && lodash_1.isFunction(toastyOptions.onAdd)) {
if (toastyOptions.onAdd && lang_1.isFunction(toastyOptions.onAdd)) {
toastyOptions.onAdd.call(this, toast);
}
} catch (e) {
Expand All @@ -308,7 +312,7 @@ System.registerDynamic("src/toasty.service", ["@angular/core", "lodash", "rxjs/O
ToastyService.THEMES = ['default', 'material', 'bootstrap'];
ToastyService = __decorate([core_1.Injectable(), __metadata('design:paramtypes', [toasty_config_1.ToastyConfig])], ToastyService);
return ToastyService;
})();
}());
exports.ToastyService = ToastyService;
return module.exports;
});
Expand Down
2 changes: 1 addition & 1 deletion bundles/ng2-toasty.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions karma-test-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ System.config({
'@angular/compiler': 'node_modules/@angular/compiler/index.js',
'@angular/common/testing': 'node_modules/@angular/common/testing.js',
'@angular/common': 'node_modules/@angular/common/index.js',
'@angular/common/src/facade/lang': 'node_modules/@angular/common/src/facade/lang.js',
'@angular/platform-browser-dynamic/testing': 'node_modules/@angular/platform-browser-dynamic/testing.js',
'@angular/platform-browser/testing': 'node_modules/@angular/platform-browser/testing.js',
'@angular/platform-browser': 'node_modules/@angular/platform-browser/index.js',
'@angular': 'node_modules/@angular',
'browser_adapter': 'node_modules/@angular/platform-browser/src/browser/browser_adapter',
'rxjs': 'node_modules/rxjs',
'lodash': 'node_modules/lodash/lodash.js'
'rxjs': 'node_modules/rxjs'
}
});

Expand Down
1 change: 0 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ module.exports = function(config) {

{ pattern: 'node_modules/@angular/**/*.js', included: false, watched: false, served: true },
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false, served: true },
{ pattern: 'node_modules/lodash/**/*.js', included: false, watched: false, served: true },
{ pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: false, watched: false, served: true }, // PhantomJS2 (and possibly others) might require it

{ pattern: 'src/**/*.ts', included: false, watched: true }, // source files
Expand Down
10 changes: 4 additions & 6 deletions make.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@ var config = {
module: 'cjs'
},
map: {
typescript: './node_modules/typescript/lib/typescript.js',
"@angular": path.resolve('node_modules/@angular'),
rxjs: path.resolve('node_modules/rxjs'),
lodash: path.resolve('node_modules/lodash/lodash.js')
'typescript': './node_modules/typescript/lib/typescript.js',
'@angular': path.resolve('node_modules/@angular'),
'rxjs': path.resolve('node_modules/rxjs')
},
paths: {
'*': '*.js'
},
meta: {
'node_modules/@angular/*': { build: false },
'node_modules/rxjs/*': { build: false },
'node_modules/lodash/*': { build: false }
'node_modules/rxjs/*': { build: false }
},
};

Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,31 @@
"main": "ng2-toasty.js",
"typings": "./ng2-toasty.d.ts",
"homepage": "https://github.com/akserg/ng2-toasty",
"devDependencies": {
"dependencies": {
"@angular/common": "^2.0.0-rc.1",
"@angular/compiler": "^2.0.0-rc.1",
"@angular/core": "^2.0.0-rc.1",
"@angular/platform-browser": "^2.0.0-rc.1",
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
"cz-conventional-changelog": "^1.1.5",
"es6-shim": "~0.35.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.6",
"zone.js": "~0.6.12"
},
"devDependencies": {
"cz-conventional-changelog": "^1.1.6",
"jasmine-core": "~2.3.4",
"karma": "~0.13.15",
"karma-chrome-launcher": "~0.2.2",
"karma-firefox-launcher": "~0.1.7",
"karma-jasmine": "~0.3.6",
"karma-typescript-preprocessor": "0.0.21",
"lodash": "^4.12.0",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"semantic-release": "^4.3.5",
"systemjs": "~0.19.27",
"systemjs-builder": "^0.15.6",
"tsd": "^0.6.5",
"typescript": "~1.7.3",
"typings": "^0.7",
"uglify-js": "^2.6.2",
"zone.js": "~0.6.12"
"systemjs": "^0.19.27",
"systemjs-builder": "^0.15.16",
"typescript": "^1.8.7",
"typings": "^0.8.1",
"uglify-js": "^2.6.2"
},
"config": {
"commitizen": {
Expand Down
2 changes: 1 addition & 1 deletion src/toasty.container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import {Component, ViewEncapsulation, Input, OnInit} from '@angular/core';
import {CORE_DIRECTIVES} from '@angular/common';
import { isFunction } from 'lodash';
import { isFunction } from '@angular/common/src/facade/lang';

import {Observable} from 'rxjs/Observable';

Expand Down
2 changes: 1 addition & 1 deletion src/toasty.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// https://github.com/akserg/ng2-toasty

import {Injectable} from '@angular/core';
import {isString, isNumber, isFunction} from 'lodash';
import {isString, isNumber, isFunction} from '@angular/common/src/facade/lang';

import {Observable} from 'rxjs/Observable';
import {Subscriber} from 'rxjs/Subscriber';
Expand Down
15 changes: 3 additions & 12 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,9 @@
"moduleResolution": "node",
"sourceMap": true
},
"files": [
"typings/main.d.ts",
"ng2-toasty.ts",
"./src/toasty.component.ts",
"./src/toasty.config.ts",
"./src/toasty.container.ts",
"./src/toasty.service.ts",
"./tests/toasty.container.spec.ts",
"./tests/toasty.component.spec.ts",
"./tests/toasty.service.spec.ts"
],
"exclude": [
"node_modules"
"node_modules",
"typings/main.d.ts",
"typings/main"
]
}
3 changes: 0 additions & 3 deletions typings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@
"ambientDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2",
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#aee0039a2d6686ec78352125010ebb38a7a7d743"
},
"dependencies": {
"lodash": "registry:npm/lodash#4.0.0+20160416211519"
}
}

0 comments on commit 632bf54

Please sign in to comment.