added Date.isDateStr(..) and minor tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-02-23 23:55:27 +03:00
parent 3a29f4b5c4
commit 8d5425fe74
3 changed files with 7 additions and 4 deletions

View File

@ -57,7 +57,7 @@ object.Mixin('DateMixin', 'soft', {
str = ' '+str
var c =
(/[^a-z](m(illi)?(-)?s(ec(ond(s)?)?)?)$/i.test(str)
|| /^[0-9]*(\.[0-9]+)?$/.test(str) ) ?
|| /^([0-9]*\.)?[0-9]+$/.test(str) ) ?
1
: /[^a-z]s(ec(ond(s)?)?)?$/i.test(str) ?
1000
@ -75,6 +75,8 @@ object.Mixin('DateMixin', 'soft', {
isPeriod: function(str){
return !isNaN(this.str2ms(str)) },
isDateStr: function(str){
return !isNaN(new Date(str).valueOf()) },
})

View File

@ -1872,8 +1872,8 @@ Add a value to the generator sequence at start/end.
-> <generator>
```
Value added by `.unshift(..)` will be yielded by `<generator>` "first", i.e. on _next_ call to `.next()`, regardless of the current generator state.
Value added by `.unshift(..)` will be yielded by `<generator>` "first", i.e. on
_next_ call to `.next()`, regardless of the current generator state.
#### `<generator>.promise()`
@ -2035,6 +2035,7 @@ currently which may not be the first element in the sequence.
Equivalents to [`<generator>`'s `.shift(..)`/`.pop(..)`/..](#generatorshift--generatorpop--generatorgshift--generatorgpop)
but returning a reusable `<func>`/`<Generator>`.
#### `<generator>.unshift(..)` / `<generator>.push(..)`
```bnf

View File

@ -1,6 +1,6 @@
{
"name": "ig-types",
"version": "6.9.3",
"version": "6.9.4",
"description": "Generic JavaScript types and type extensions...",
"main": "main.js",
"scripts": {