0.1.0 • Published 10 years ago
turbo-lodash v0.1.0
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 = 'me@example.com';
_.isValidEmail(email);
// -> true
var email = 'me@me.t';
_.isValidEmail(email);
// -> false
0.1.0
10 years ago