* Return `true` if the given number is negative, or if the given string contains a negative sign : * - everywhere in the string (by default), or * - on the first character only if the `checkEverywhere` parameter is set to `false`. * * Note: `-0` is not a negative number since it'
(numberOrNumericString, negativeSignCharacter = '-', checkEverywhere = true)
| 498 | * @returns {boolean} |
| 499 | */ |
| 500 | static isNegative(numberOrNumericString, negativeSignCharacter = '-', checkEverywhere = true) { |
| 501 | if (numberOrNumericString === negativeSignCharacter) { |
| 502 | return true; |
| 503 | } |
| 504 | |
| 505 | if (numberOrNumericString === '') { |
| 506 | return false; |
| 507 | } |
| 508 | |
| 509 | if (AutoNumericHelper.isNumber(numberOrNumericString)) { |
| 510 | return numberOrNumericString < 0; |
| 511 | } |
| 512 | |
| 513 | if (checkEverywhere) { |
| 514 | return this.contains(numberOrNumericString, negativeSignCharacter); |
| 515 | } |
| 516 | |
| 517 | return this.isNegativeStrict(numberOrNumericString, negativeSignCharacter); |
| 518 | } |
| 519 | |
| 520 | /** |
| 521 | * Return `true` if the given string contains a negative sign on the first character (on the far left). |
no test coverage detected