Giter Club home page Giter Club logo

grasp's People

Watchers

 avatar  avatar  avatar

grasp's Issues

Replace with actions

squery-replace test needs to pass when appending a node as follows.

      const find = """
        class[key=#Hello] body[type=#ClassBody]
      """

      const replace = """
        {{ .body | append:fn }}
      """

      const code = '''class Hello {
      }'''

      const actions = [{
        action: 'append',
        name: 'fn',
        nodes: [{
          type: 'Raw',
          raw: 'hello () { }'
        }]
      }]

      const replacer = grasp.replace 'squery', {find, replace, actions }
      const result = replacer.replace(code)
      const expected = """class Hello {
        hello () { }
      }"""

      equal (result, expected)

Here the .body of the replace returns a list of Nodes matched (see esprima query). Then we need to use the append:fn to find the named fn append action in actionsand concat the nodes there to the.body` AST Node Array.

Refactor to ES6

Project is currently in LiveScript. We need it to refactored in ES6 to me more maintainable

Use the refactor branch as a starting point. Port the existing tests to ES6 and make them all pass...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.