added newObjectFrom

This commit is contained in:
Martin Donnelly 2016-03-30 14:24:22 +01:00
parent ba475dc668
commit 03ba3f83dc

View File

@ -9,7 +9,15 @@
module.exports = {
reDashObject(source) {
newObjectFrom(source, fields) {
var rObj = {};
for (var item in fields) {
if (source.hasOwnProperty(fields[item])) {
rObj[fields[item]] = source[fields[item]];
}
}
return rObj;
}, reDashObject(source) {
var rObj = {};
for (var item in source) {
if (source.hasOwnProperty(item)) {
@ -19,8 +27,7 @@ module.exports = {
}
return rObj;
},
unDashObject(source) {
}, unDashObject(source) {
var rObj = {};
for (var item in source) {
if (source.hasOwnProperty(item)) {
@ -67,7 +74,8 @@ module.exports = {
ch = text.charAt(i);
if (ch === ' ') {
s.push(' ');
} else if (ch.charCodeAt(0) < 255 && CHECKCHARS.indexOf(ch) !== -1) {
}
else if (ch.charCodeAt(0) < 255 && CHECKCHARS.indexOf(ch) !== -1) {
s.push(ch);
}
}