mirror of
https://gitlab.silvrtree.co.uk/martind2000/md-utils.git
synced 2025-01-26 20:36:17 +00:00
added newObjectFrom
This commit is contained in:
parent
ba475dc668
commit
03ba3f83dc
16
index.js
16
index.js
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user