Add url helper to simplify url names

This commit is contained in:
perryharlock
2013-09-17 11:16:20 +01:00
parent a4184f4cf3
commit 0d9a467663
3 changed files with 14 additions and 1 deletions

12
view/helper/url.js Normal file
View File

@@ -0,0 +1,12 @@
'use strict';
module.exports = helper;
function helper (register) {
// Simplify url by removing (eg http://, https://, trailing slashes) from url
register('simplify-url', function (context) {
return context.replace(/^https?:\/\//i, '').replace(/\/$/, '');
});
}