( value: any // eslint-disable-line )
| 166 | * @public |
| 167 | */ |
| 168 | export function empty( |
| 169 | value: any // eslint-disable-line |
| 170 | ): boolean { |
| 171 | const type = typeof value |
| 172 | if (type === 'number') return false |
| 173 | if (value === undefined) return true |
| 174 | if (type === 'string') { |
| 175 | return value === '' |
| 176 | } |
| 177 | if (type === 'object') { |
| 178 | if (value === null) return true |
| 179 | for (const _i in value) return false |
| 180 | if (value instanceof RegExp) return false |
| 181 | if (value instanceof Date) return false |
| 182 | return true |
| 183 | } |
| 184 | return false |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * Escape a string for use in regular expressions. |
no outgoing calls