angular filters ES6 refactoring

This commit is contained in:
tmshv committed 2016-02-22 02:20:40 +03:00
1 parent c3b095feb4
commit a227082638
7 files changed
+26 -46

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
export default function(app) {
app.filter('removeHashtags', () => {
return string => string.replace(/(#[^\s]+)/g, '');
});
};
+5
View File
@@ -0,0 +1,5 @@
export default function(app) {
app.filter('uppercaseFirst', () => {
return string => string.charAt(0).toUpperCase() + string.slice(1);
});
};
-11
View File
@@ -1,11 +0,0 @@
/**
* Created by tmshv on 21/11/14.
*/
module.exports = function(app) {
app.filter("removeHashtags", function () {
return function(string) {
return string.replace(/(#[^\s]+)/g, '');
};
});
};
+3 -9
View File
@@ -1,11 +1,5 @@
/**
* Created by tmshv on 21/11/14.
*/
module.exports = function(app) {
app.filter("removeNewline", function () {
return function(string) {
return string.replace(/(\n)/g, ' ');
};
export default function(app) {
app.filter('removeNewline', () =>{
return string => string.replace(/(\n)/g, ' ');
});
};
+5 -11
View File
@@ -1,13 +1,7 @@
/**
* Created by tmshv on 21/11/14.
*/
module.exports = function(app) {
app.filter("strip", function () {
return function(string) {
return string
.replace(/^\s+/, '')
.replace(/\s+$/, '');
};
export default function (app) {
app.filter('strip', () => {
return string => string
.replace(/^\s+/, '')
.replace(/\s+$/, '');
});
};
-11
View File
@@ -1,11 +0,0 @@
/**
* Created by tmshv on 21/11/14.
*/
module.exports = function(app) {
app.filter("uppercaseFirst", function () {
return function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
};
});
};