GithubHelp home page GithubHelp logo

jonschlinkert / get-exports Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 104 KB

CLI for getting/creating a list of node.js export statements for functions in a module. Why? I want to write pure JavaScript and not worry about remembering to add export statements until js-hint complains about it.

License: MIT License

JavaScript 100.00%

get-exports's Introduction

get-exports NPM version

CLI for getting/creating a list of node.js export statements for functions in a module. Why? I want to write pure JavaScript and not worry about remembering to add export statements until js-hint complains about it.

This is more of a linting tool for export statements than anything. Just type ext and the name of the file to read and the CLI will output a list of statements like export.foo = foo'; for you to manually add to the file.

Install

Install with npm:

npm i get-exports --save-dev

Run tests

npm test

Usage

CLI

From the command line, just run:

exp [filename] > foo.txt

In foo.txt you should see something like (of course, with the names of the functions/methods in your application):

exports.foo = foo;
exports.bar = bar;
exports.baz = baz;

I considered adding logic to append this to the file, but this is simple enough and gives you a chance to look things over before adding them to the file.

API

To use with a node.js application, just do:

var getExports = require('get-exports');
getExports('index.js');

Returns something like:

exports.foo = foo;
exports.bar = bar;
exports.baz = baz;

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license


This file was generated by verb-cli on September 30, 2014.

get-exports's People

Contributors

jonschlinkert avatar

Stargazers

Cat  avatar Charlike Mike Reagent avatar  avatar

Watchers

 avatar Brian Woodward avatar  avatar

get-exports's Issues

Support ES6

I tried use this lib with a file like to:

export const c1 = "100";
export const c2 = ()=>"100";
export default () => <h1>100</h1>;

My expectative retur is:

exports.default = default;
exports.c1= c1;
exports.c2= c2;

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.