diff --git a/index.js b/index.js index 1b2c110..ead2a65 100644 --- a/index.js +++ b/index.js @@ -48,8 +48,18 @@ ArrayParser.prototype.newEntry = function (includeEmpty) { } } +ArrayParser.prototype.consumeDimensions = function () { + if (this.source[0] === '[') { + while (!this.isEof()) { + var char = this.nextCharacter() + if (char.value === '=') break + } + } +} + ArrayParser.prototype.parse = function (nested) { var character, parser, quote + this.consumeDimensions() while (!this.isEof()) { character = this.nextCharacter() if (character.value === '{' && !quote) { diff --git a/test.js b/test.js index 6512e00..d15b7e6 100644 --- a/test.js +++ b/test.js @@ -15,6 +15,7 @@ test(function (t) { var integer = ap.partialRight(array.parse, ap.partialRight(parseInt, 10)) t.deepEqual(integer('{1,2,3}'), [1, 2, 3], 'numerics') + t.deepEqual(integer('[0:2]={1,2,3}'), [1, 2, 3], 'numerics') t.end() })