init project
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
// https://github.com/HenrikJoreteg/extend-object/blob/v0.1.0/extend-object.js
|
||||
|
||||
var arr = [];
|
||||
var each = arr.forEach;
|
||||
var slice = arr.slice;
|
||||
|
||||
module.exports.extend = function(obj) {
|
||||
each.call(slice.call(arguments, 1), function(source) {
|
||||
if (source) {
|
||||
for (var prop in source) {
|
||||
obj[prop] = source[prop];
|
||||
}
|
||||
}
|
||||
});
|
||||
return obj;
|
||||
};
|
||||
|
||||
module.exports.parseJSON = function(s) {
|
||||
try {
|
||||
return JSON.parse(s);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user