angular filters ES6 refactoring
This commit is contained in:
1 parent
c3b095feb4
commit
a227082638
7 files changed
+26
-46
No files matched your search
+8
-4
@@ -12,6 +12,10 @@ import AppController from './controllers/AppController';
|
|||||||
import HomeController from './controllers/HomeController';
|
import HomeController from './controllers/HomeController';
|
||||||
import TeamController from './controllers/TeamController';
|
import TeamController from './controllers/TeamController';
|
||||||
import DocumentsController from './controllers/DocumentsController';
|
import DocumentsController from './controllers/DocumentsController';
|
||||||
|
import RemoveHashtags from './filters/RemoveHashtags';
|
||||||
|
import RemoveNewline from './filters/RemoveNewline';
|
||||||
|
import Strip from './filters/Strip';
|
||||||
|
import UppercaseFirst from './filters/UppercaseFirst';
|
||||||
import IOService from './services/io';
|
import IOService from './services/io';
|
||||||
import MenuService from './services/menu';
|
import MenuService from './services/menu';
|
||||||
import api from './api/api';
|
import api from './api/api';
|
||||||
@@ -93,11 +97,11 @@ app.run(($location, $rootScope, $http) => {
|
|||||||
api,
|
api,
|
||||||
IOService,
|
IOService,
|
||||||
MenuService,
|
MenuService,
|
||||||
|
RemoveHashtags,
|
||||||
|
RemoveNewline,
|
||||||
|
Strip,
|
||||||
|
UppercaseFirst,
|
||||||
require('./ui/timeline'),
|
require('./ui/timeline'),
|
||||||
require('./filters/strip'),
|
|
||||||
require('./filters/remove-hashtags'),
|
|
||||||
require('./filters/removeNewline'),
|
|
||||||
require('./filters/uppercase-first'),
|
|
||||||
require('./pages/schedule'),
|
require('./pages/schedule'),
|
||||||
require('./pages/gallery'),
|
require('./pages/gallery'),
|
||||||
require('./controllers/ContactsController'),
|
require('./controllers/ContactsController'),
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export default function(app) {
|
||||||
|
app.filter('removeHashtags', () => {
|
||||||
|
return string => string.replace(/(#[^\s]+)/g, '');
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export default function(app) {
|
||||||
|
app.filter('uppercaseFirst', () => {
|
||||||
|
return string => string.charAt(0).toUpperCase() + string.slice(1);
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -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, '');
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
@@ -1,11 +1,5 @@
|
|||||||
/**
|
export default function(app) {
|
||||||
* Created by tmshv on 21/11/14.
|
app.filter('removeNewline', () =>{
|
||||||
*/
|
return string => string.replace(/(\n)/g, ' ');
|
||||||
|
|
||||||
module.exports = function(app) {
|
|
||||||
app.filter("removeNewline", function () {
|
|
||||||
return function(string) {
|
|
||||||
return string.replace(/(\n)/g, ' ');
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -1,13 +1,7 @@
|
|||||||
/**
|
export default function (app) {
|
||||||
* Created by tmshv on 21/11/14.
|
app.filter('strip', () => {
|
||||||
*/
|
return string => string
|
||||||
|
.replace(/^\s+/, '')
|
||||||
module.exports = function(app) {
|
.replace(/\s+$/, '');
|
||||||
app.filter("strip", function () {
|
|
||||||
return function(string) {
|
|
||||||
return string
|
|
||||||
.replace(/^\s+/, '')
|
|
||||||
.replace(/\s+$/, '');
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -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);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Reference in new issue
Block a user