babel-plugin-tinytime

    0.1.2 • Public • Published

    Babel Plugin for tinytime

    Automatically transform usage of tinytime that is not recommended to the optimal way of using it.

    Transforms

    function Time({ date }) {
      return (
        <div>
          {tinytime('{h}:{mm}:{ss}{a}').render(date)}
        </div>
      )
    }

    to something in the effect of:

    const template = tinytime('{h}:{mm}:{ss}{a}');
    function Time({ date }) {
      return (
        <div>
          {template.render(date)}
        </div>
      )
    }

    Reasoning behind why this is needed can be read here: https://github.com/aweary/tinytime#efficiency.

    Install

    // Yarn
    yarn add babel-plugin-tinytime --dev
    
    // NPM
    npm install babel-plugin-tinytime --save-dev
    

    Usage

    .babelrc
    {
      "presets": ["es2015"],
      "plugins": ["tinytime"]
    }

    Install

    npm i babel-plugin-tinytime

    DownloadsWeekly Downloads

    1

    Version

    0.1.2

    License

    MIT

    Last publish

    Collaborators

    • dnlsandiego