Skip to content

Instantly share code, notes, and snippets.

View craigrbruce's full-sized avatar
🏠
Working from home

Craig Bruce craigrbruce

🏠
Working from home
View GitHub Profile
@craigrbruce
craigrbruce / isObjectDirty.js
Created July 7, 2016 05:38
Object property dirty checker with dependency on lodash
/**
* Checks all fields of an object literal for values.
* @param {Object} object - A POJO.
* @param {Array<String>} omitProperies - An array of properties that you wish to omit from the checker e.g. "id".
* @returns {Boolean}
*/
function isObjectDirty(object, omitProperties) {
if(omitProperties) {
object = _.omit(object, omitProperties);
}