ig-types 6.9.3 → 6.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Date.js CHANGED
@@ -57,7 +57,7 @@ object.Mixin('DateMixin', 'soft', {
57
57
  str = ' '+str
58
58
  var c =
59
59
  (/[^a-z](m(illi)?(-)?s(ec(ond(s)?)?)?)$/i.test(str)
60
- || /^[0-9]*(\.[0-9]+)?$/.test(str) ) ?
60
+ || /^([0-9]*\.)?[0-9]+$/.test(str) ) ?
61
61
  1
62
62
  : /[^a-z]s(ec(ond(s)?)?)?$/i.test(str) ?
63
63
  1000
@@ -75,6 +75,8 @@ object.Mixin('DateMixin', 'soft', {
75
75
 
76
76
  isPeriod: function(str){
77
77
  return !isNaN(this.str2ms(str)) },
78
+ isDateStr: function(str){
79
+ return !isNaN(new Date(str).valueOf()) },
78
80
  })
79
81
 
80
82
 
package/README.md CHANGED
@@ -1872,8 +1872,8 @@ Add a value to the generator sequence at start/end.
1872
1872
  -> <generator>
1873
1873
  ```
1874
1874
 
1875
- Value added by `.unshift(..)` will be yielded by `<generator>` "first", i.e. on _next_ call to `.next()`, regardless of the current generator state.
1876
-
1875
+ Value added by `.unshift(..)` will be yielded by `<generator>` "first", i.e. on
1876
+ _next_ call to `.next()`, regardless of the current generator state.
1877
1877
 
1878
1878
 
1879
1879
  #### `<generator>.promise()`
@@ -2035,6 +2035,7 @@ currently which may not be the first element in the sequence.
2035
2035
  Equivalents to [`<generator>`'s `.shift(..)`/`.pop(..)`/..](#generatorshift--generatorpop--generatorgshift--generatorgpop)
2036
2036
  but returning a reusable `<func>`/`<Generator>`.
2037
2037
 
2038
+
2038
2039
  #### `<generator>.unshift(..)` / `<generator>.push(..)`
2039
2040
 
2040
2041
  ```bnf
package/RegExp.js CHANGED
@@ -23,7 +23,48 @@ object.Mixin('RegExpMixin', 'soft', {
23
23
  })
24
24
 
25
25
 
26
+ var GROUP_PATERN =
27
+ //module.GROUP_PATERN = /(^\(|[^\\]\()/g
28
+ module.GROUP_PATERN = new RegExp([
29
+ '^\\(',
30
+ // non-escaped braces...
31
+ '[^\\\\]\\(',
32
+ // XXX ignore braces in ranges...
33
+ // XXX '\\[.*(.*\\]',
34
+ ].join('|'))
35
+
36
+ // Pattern group introspection...
37
+ var RegExpProtoMixin =
38
+ module.RegExpProtoMixin =
39
+ object.Mixin('RegExpProtoMixin', 'soft', {
40
+ // Format:
41
+ // [
42
+ // {
43
+ // index: <index>,
44
+ // name: <name>,
45
+ // pattern: <string>,
46
+ // offset: <offset>,
47
+ // },
48
+ // ...
49
+ // ]
50
+ // XXX cache this...
51
+ get groups(){
52
+ this.toString()
53
+ .matchAll(GROUP_PATERN)
54
+ },
55
+ get namedGroups(){
56
+ return this.groups
57
+ .reduce(function(res, e){
58
+ e.name
59
+ && (res[name] = e)
60
+ return res }, {}) },
61
+ get groupCount(){
62
+ return this.groups.length },
63
+ })
64
+
65
+
26
66
  RegExpMixin(RegExp)
67
+ RegExpProtoMixin(RegExp.prototype)
27
68
 
28
69
 
29
70
  var quoteRegExp =
package/event.js CHANGED
@@ -34,17 +34,17 @@ module.TRIGGER = module.EventCommand('TRIGGER')
34
34
 
35
35
 
36
36
 
37
- // Create an "eventfull" method...
37
+ // Create an "eventful" method...
38
38
  //
39
39
  // The resulting method can be either called directly or via .trigger(..).
40
40
  // Handlrs can be bound to it via .on(..) and unbound via .off(..) and
41
41
  // calling it will trigger the handlers either after the user func(..)
42
42
  // return or when the user calles the passed handler(..) function.
43
43
  //
44
- // Eventfull(name[, options])
44
+ // Eventful(name[, options])
45
45
  // -> method
46
46
  //
47
- // Eventfull(name, func[, options])
47
+ // Eventful(name, func[, options])
48
48
  // -> method
49
49
  //
50
50
  //
@@ -88,9 +88,9 @@ module.TRIGGER = module.EventCommand('TRIGGER')
88
88
  //
89
89
  // NOTE: calling handle(false) will exiplicitly disable calling the
90
90
  // handlers for that call...
91
- var Eventfull =
92
- module.Eventfull =
93
- object.Constructor('Eventfull', {
91
+ var Eventful =
92
+ module.Eventful =
93
+ object.Constructor('Eventful', {
94
94
 
95
95
  handlerLocation: 'context',
96
96
 
@@ -189,7 +189,7 @@ object.Constructor('Eventfull', {
189
189
  })
190
190
 
191
191
 
192
- // Extends Eventfull(..) adding ability to bind events via the
192
+ // Extends Eventful(..) adding ability to bind events via the
193
193
  // resulting method directly by passing it a function...
194
194
  //
195
195
  // Event(name[, options])
@@ -225,7 +225,7 @@ object.Constructor('Eventfull', {
225
225
  // arg is a function or not...
226
226
  var Event =
227
227
  module.Event =
228
- object.Constructor('Event', Eventfull, {
228
+ object.Constructor('Event', Eventful, {
229
229
  toString: function(){
230
230
  return this.orig_func ?
231
231
  'Event '
@@ -241,7 +241,7 @@ object.Constructor('Event', Eventfull, {
241
241
  // call the action...
242
242
  : object.parentCall(Event.prototype.__call__, this, context, ...args)
243
243
  // XXX workaround for above line -- remove when fully tested...
244
- //: Eventfull.prototype.__call__.call(this, context, ...args)
244
+ //: Eventful.prototype.__call__.call(this, context, ...args)
245
245
  return context },
246
246
  })
247
247
 
@@ -330,13 +330,13 @@ module.EventHandlerMixin = object.Mixin('EventHandlerMixin', {
330
330
  // instead...
331
331
  var EventDocMixin =
332
332
  module.EventDocMixin = object.Mixin('EventDocMixin', {
333
- get eventfull(){
333
+ get eventful(){
334
334
  return object.deepKeys(this)
335
335
  .filter(function(n){
336
336
  // avoid triggering props...
337
337
  return !object.values(this, n, function(){ return object.STOP }, true)[0].get
338
338
  // XXX this is too strict...
339
- && (this[n] || {}).constructor === Eventfull}.bind(this)) },
339
+ && (this[n] || {}).constructor === Eventful}.bind(this)) },
340
340
  get events(){
341
341
  return object.deepKeys(this)
342
342
  .filter(function(n){
package/main.js CHANGED
@@ -29,8 +29,11 @@ module.runner = require('./runner')
29
29
 
30
30
  // Shorthands...
31
31
  module.STOP = object.STOP
32
- // NOTE: this is a generic enough type to be accessible at the root...
32
+
33
+ // frequently used stuff...
33
34
  module.Generator = module.generator.Generator
35
+ // XXX doc...
36
+ module.iter = module.generator.iter
34
37
 
35
38
 
36
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ig-types",
3
- "version": "6.9.3",
3
+ "version": "6.10.0",
4
4
  "description": "Generic JavaScript types and type extensions...",
5
5
  "main": "main.js",
6
6
  "scripts": {
package/test.js CHANGED
@@ -381,19 +381,19 @@ Events.cases({
381
381
 
382
382
  // blank events...
383
383
  bareEventBlank: assert(
384
- events.Eventfull('bareEventBlank'),
385
- '.Eventfull(..): blank'),
384
+ events.Eventful('bareEventBlank'),
385
+ '.Eventful(..): blank'),
386
386
  eventBlank: assert(
387
387
  events.Event('eventBlank'),
388
388
  '.Event(..): blank'),
389
389
 
390
390
  // normal events...
391
- bareEvent: assert(events.Eventfull('bareEvent',
391
+ bareEvent: assert(events.Eventful('bareEvent',
392
392
  function(handle, ...args){
393
393
  called['bareEvent-call'] = true
394
- assert(handle(), '.Eventfull(..) -> handle(..)')
394
+ assert(handle(), '.Eventful(..) -> handle(..)')
395
395
  return 'bareEvent'
396
- }), '.Eventfull(..)'),
396
+ }), '.Eventful(..)'),
397
397
  event: assert(events.Event('event',
398
398
  function(handle, ...args){
399
399
  called['event-call'] = true
@@ -408,7 +408,7 @@ Events.cases({
408
408
 
409
409
  // test event list...
410
410
  assert.array(obj.events, ['event', 'eventBlank'], '.events')
411
- assert.array(obj.eventfull, ['bareEvent', 'bareEventBlank'], '.eventfull')
411
+ assert.array(obj.eventful, ['bareEvent', 'bareEventBlank'], '.eventful')
412
412
 
413
413
  // bind...
414
414
  var bind = function(evt){
@@ -418,7 +418,7 @@ Events.cases({
418
418
 
419
419
  ;['moo',
420
420
  ...obj.events,
421
- ...obj.eventfull]
421
+ ...obj.eventful]
422
422
  .forEach(bind)
423
423
 
424
424
  assert(obj.event(function(evt, ...args){