ig-types 6.9.4 → 6.9.5

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.
Files changed (3) hide show
  1. package/RegExp.js +41 -0
  2. package/main.js +3 -1
  3. package/package.json +1 -1
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/main.js CHANGED
@@ -29,8 +29,10 @@ 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
+ module.iter = module.generator.iter
34
36
 
35
37
 
36
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ig-types",
3
- "version": "6.9.4",
3
+ "version": "6.9.5",
4
4
  "description": "Generic JavaScript types and type extensions...",
5
5
  "main": "main.js",
6
6
  "scripts": {