lazo-next
Version:
A client-server web framework built on Node.js that allows front-end developers to easily create a 100% SEO compliant, component MVC structured web application with an optimized first page load.
26 lines (18 loc) • 536 B
JavaScript
define(['underscore'], function (_) {
'use strict';
var subRegEx = /\{\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}\}/g;
return {
methodMap: {
'create': 'POST',
'update': 'PUT',
'patch': 'PATCH',
'delete': 'DELETE',
'read': 'GET'
},
substitute: function (s, o) {
return s.replace ? s.replace(subRegEx, function (match, key) {
return _.isUndefined(o[key]) ? match : o[key];
}) : s;
}
};
});