UNPKG

are-message

Version:

This is a React global notification message component. It is a standalone implementation of the are-visual message component.

17 lines (14 loc) 353 B
/** * 过滤 undefined, null, '', NaN */ export function isTruthy(value) { var notEmptyStr = true; var notNaN = true; if (typeof value === 'string') { notEmptyStr = value.trim() !== ''; } if (typeof value === 'number') { notNaN = !Number.isNaN(value); } return value !== undefined && value !== null && notEmptyStr && notNaN; }