fix(input): checked attr can be an empty string or no value

This commit is contained in:
Adam Bradley
2016-01-26 11:11:48 -06:00
parent 42f6b1056f
commit e76b55994c
13 changed files with 291 additions and 223 deletions

View File

@ -111,7 +111,16 @@ export const isUndefined = val => typeof val === 'undefined';
export const isBlank = val => val === undefined || val === null;
export const isObject = val => typeof val === 'object';
export const isArray = Array.isArray;
export const isTrueProperty = val => typeof val !== 'undefined' && val !== "false";
export const isTrueProperty = function(val) {
if (typeof val === 'boolean') return val;
if (typeof val === 'string') {
val = val.toLowerCase().trim();
return (val === 'true' || val === '');
}
if (typeof val === 'number') return (val > 0);
return !!val;
};
/**
* Convert a string in the format thisIsAString to a slug format this-is-a-string