turbo-lodash
v0.1.0
Published
A set of mixins for lodash.
Downloads
1
Readme
lodash-mixins
A set of mixins for lodash.
Mixins
_.getOrElse(obj, key, elseValue)
var user = {
name: 'Frank'
};
_.getOrElse(user, 'name', 'John');
// -> Frank
_.getOrElse(user, 'age', 20);
// -> 20
_.mergeArrays(olds, news, key)
var olds = [{
_id: 1,
name: 'Milk'
}, {
_id: 2,
name: 'Eggs'
}];
var news = [{
_id: 2,
name: 'Meat'
}, {
_id: 1,
name: 'Hamburger'
}];
_.mergeArrays(olds, news, '_id');
// -> [{ _id: 1 name: 'Hamburger' }, { _id: 2, name: 'Meat' }]
_.isValidUrl(url)
var url = 'http://google.com';
_.isValidUrl(url);
// -> true
var url = 'http://google';
_.isValidUrl(url);
// -> false
_.isValidEmail(email)
var email = '[email protected]';
_.isValidEmail(email);
// -> true
var email = '[email protected]';
_.isValidEmail(email);
// -> false