Permalink
Switch branches/tags
Commits on Apr 25, 2017
  1. Revert isPatternNext to isQuantifierNext

    This makes the "Constructor with x flag, whitespace, and comments" test
    fast again. From #164 (comment):
    
    > A couple ideas: avoid the string concatenation in `isPatternNext`
    > (possibly going back to regex literals and making the function specific
    > to quantifiers again even though the current code is more
    > readable/maintainable, since this isn't needed to handle simple cases
    > with whitespace followed by `)`)
    
    Since babel-plugin-transform-xregexp automatically compiles the `new
    RegExp()` calls into literals, we get (most of) the performance back
    without sacrificing the readability of having separate subpatterns.
    josephfrazier committed with Apr 25, 2017
  2. Use babel-plugin-transform-xregexp

    This add [babel-plugin-transform-xregexp] to the build process, which
    allows XRegExp to "self-host" in a sense. Note that `new Regexp()` is
    compiled to `/(?:)/`.
    
    [babel-plugin-transform-xregexp]: https://www.npmjs.com/package/babel-plugin-transform-xregexp
    josephfrazier committed with Apr 19, 2017
Commits on Apr 19, 2017
  1. build

    josephfrazier committed with Apr 17, 2017
  2. Use babel with babel-preset-env to compile src/ files to lib/

    Following up on #108 (comment),
    this change adds [Babel] to the build process, with [babel-preset-env] to
    ensure browser compatibility. It defaults to supporting all ES5
    browsers, but can be tweaked in the future.
    
    To reduce potential merge conflicts, this commit intentionally omits the
    resulting changes to `xregexp-all.js`, but they are only formatting
    changes anyway (you can use a tool like [prettier-diff] to see this). In
    particular, `'use strict';` is prepended to every module in the bundle.
    Of course, this shouldn't affect the API or browser compatibility.
    
    The [transform-es2015-literals] plugin is [excluded] to avoid changing
    unicode strings. See #174 (comment)
    
    After this commit, a separate "build" commit should be made that updates
    `xregexp-all.js`.
    
    [Babel]: https://babeljs.io/
    [babel-preset-env]: https://github.com/babel/babel-preset-env
    [prettier-diff]: https://github.com/josephfrazier/prettier-diff
    [transform-es2015-literals]: https://www.npmjs.com/package/babel-plugin-transform-es2015-literals
    [excluded]: babel/babel-preset-env#30 (comment)
    josephfrazier committed with Apr 10, 2017
Commits on Apr 16, 2017
  1. Update version to 3.2.0

    committed Apr 16, 2017
  2. More README updates

    committed Apr 16, 2017
  3. Update README

    committed Apr 16, 2017
  4. Fix off-by-1 error

    committed Apr 16, 2017
  5. Merge pull request #164 from josephfrazier/strip-useless-groups

    Cleanup (?:) from beginning/end of groups
    committed on GitHub Apr 16, 2017
Commits on Apr 15, 2017
  1. Declare each `var` on a separate line (#172)

    * Declare each `var` on a separate line
    
    This partially addresses the following item in #107:
    
    > * New `var` on each line, and don't always declare vars at top of
    function.
    
    The change was made with the help of [lebab], by running:
    
        lebab --replace src --transform multi-var
    
    [lebab]: https://github.com/lebab/lebab
    
    * Remove blank lines from `var` declarations
    
    See #172 (review)
    josephfrazier committed with Apr 15, 2017
  2. Change `<li>`s to hyphens in code comments (#173)

    As seen in #107:
    
    > * Change `<li>`s to asterisks or hyphens in code comments.
    
    I used hyphens rather than asterisks because each comment line already
    starts with an asterisk, so hyphens visually stand out more.
    josephfrazier committed with Apr 15, 2017
Commits on Apr 10, 2017
  1. 2016 -> 2017

    committed Apr 10, 2017
  2. Add `conjunction` option for XRegExp.union and allow setting to 'none' (

    #169)
    
    The `XRegExp.union` calls in the `build` and `matchRecursive` addons are
    also updated to explicitly specify `{conjunction: 'or'}`.
    
    Fixes #106
    josephfrazier committed with Apr 10, 2017
  3. Revert "Work around bug in Safari Technology Preview /y support -- cl…

    …oses #135" (#168)
    
    Closes #158
    
    This reverts commit 660f3ac.
    josephfrazier committed with Apr 10, 2017
Commits on Apr 4, 2017
  1. Include build package in package.json for npm installs. (#167)

    * Include build package in package.json for npm installs.
    
    * Update main to point to distribution build. Include LICENSE in files for npm installs.
    kaidjohnson committed with Apr 4, 2017
Commits on Mar 28, 2017
  1. fixup! Extract isPatternNext helper from isQuantifierNext

    Use `new` with RegExp constructor, as is done everywhere else.
    josephfrazier committed Mar 28, 2017
  2. Extract getCommentOrWhitespace helper from token handlers

    I realized the token handlers are equivalent, so I made them a named
    function instead.
    josephfrazier committed Mar 28, 2017
  3. Don't insert (?:) at the beginning/end of a group

    This passes the tests in the previous commit, using the new
    isPatternNext function to determine if the match is at the end of a
    group.
    
    Checking if the match is at the beginning of a group is a little
    more naive, since it only looks at the previous character, rather than
    ignoring comments and whitespace, but I haven't found a good way to
    improve on that.
    josephfrazier committed Mar 28, 2017
  4. Test that XRegExp should not put (?:) at beginning/end of groups

    This test currently fails. Here's the actual and expected patterns, with
    whitespace inserted to illustrate the difference:
    
    '((?:)[0-9]{4}(?:))(?:)-?(?:)((?:)[0-9]{2}(?:))(?:)-?(?:)((?:)[0-9]{2}(?:))(?:)'
    '(    [0-9]{4}    )(?:)-?(?:)(    [0-9]{2}    )(?:)-?(?:)(    [0-9]{2}    )(?:)'
    josephfrazier committed Feb 19, 2017
  5. Extract isPatternNext helper from isQuantifierNext

    This will allow us to use it for matching other patterns than just
    quantifiers.
    josephfrazier committed Mar 28, 2017
  6. Use subpatterns in isQuantifierNext

    This doesn't change its behavior, but makes it more readable and easier
    to modify.
    josephfrazier committed Mar 28, 2017
Commits on Mar 24, 2017
  1. Tweaks

    committed Mar 24, 2017
Commits on Mar 23, 2017
  1. Pass XRegExp.build flags through asXRegExp to XRegExp constructor (#163)

    Work around Firefox issue where '\n' is not ignored with flag x when used with XRegExp.build. See #163.
    josephfrazier committed with Mar 23, 2017
  2. Merge pull request #160 from josephfrazier/travis

    Add Travis CI configuration
    committed on GitHub Mar 23, 2017
Commits on Feb 14, 2017
  1. .editorconfig: Set *.yml indent_size to 2

    This is the convention for .travis.yml files.
    josephfrazier committed Feb 14, 2017
  2. Merge pull request #159 from josephfrazier/test-node

    Make tests run in Node
    committed on GitHub Feb 14, 2017
  3. Make tests run in Node

    This is a follow-up to
    #155 (comment)
    that lets the tests run in Node, without opening a browser. It's set up
    so that opening tests/index.html still works, for anyone who prefers
    that workflow.
    
    See the jasmine docs for more info on using it with Node: https://jasmine.github.io/2.5/node.html
    josephfrazier committed Feb 14, 2017