0.2.1 • Published 6 years ago

mlh-javascript v0.2.1

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

mlh-javascript

This is a node packages that shares common javascript behaviors accross various NLH websites.

Instalation and Usage

  1. Install the package wuth npm i --save mlh-javascript
  2. Import code into your javascript file by including the following line on top of your file import MLH from 'mlh-javascript';
  3. You can use any functions inside MLHAuth module by calling them agains MLHAuth object. Like so:

    import MLH from 'mlh-javascript';
    
    MLH.auth.login( function(user) {
      // do something with user
    })

Development

  1. Clone the repository git clone https://github.com/MLH/mlh-javascript.git
  2. Change into the directory cd mlh-javascriptand install dependencies with npm i
  3. Start a development server with npm start
  4. In the root of the project there's an index html file, it's for development only, In case you need to add any triggers to test code(buttons, links etc.).
  5. For creating separate modules make a new file in the js folder, for example validateInput.js. Write some functions in it, for example

      function validateEmail(email) {
        // do something
      }
    
      function validatePassword(password) {
        // do something
      }
    
      export default {
        validateEmail,
        validatePassword
      }
  6. Import the module in the index.js file import validations from './js/validateInput, and add it to the exports at the bottom of the file.

      export default {
        auth,
        validations
      };
  7. Add, commit, merge, update version of the package to reflect changes you made with npm version <newversion>, <newversion> should be a valid semver string, for example '2.3.1'.
  8. Publish to npm with npm publish
0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago