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 TeamController from './controllers/TeamController';
|
||||
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 MenuService from './services/menu';
|
||||
import api from './api/api';
|
||||
@@ -93,11 +97,11 @@ app.run(($location, $rootScope, $http) => {
|
||||
api,
|
||||
IOService,
|
||||
MenuService,
|
||||
RemoveHashtags,
|
||||
RemoveNewline,
|
||||
Strip,
|
||||
UppercaseFirst,
|
||||
require('./ui/timeline'),
|
||||
require('./filters/strip'),
|
||||
require('./filters/remove-hashtags'),
|
||||
require('./filters/removeNewline'),
|
||||
require('./filters/uppercase-first'),
|
||||
require('./pages/schedule'),
|
||||
require('./pages/gallery'),
|
||||
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 @@
|
||||
/**
|
||||
* 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, ' ');
|
||||
});
|
||||
};
|
||||
@@ -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+$/, '');
|
||||
});
|
||||
};
|
||||
@@ -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