turbo-lodash

0.1.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i turbo-lodash

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • ascariandrea