@linx-impulse/commons-js

A library with common function implementations for Javascript Applications.

Stats

StarsIssuesVersionUpdatedCreatedSize
@linx-impulse/commons-js
3144.4.110 months ago3 years agoMinified + gzip package size for @linx-impulse/commons-js in KB

Readme

Linx Commons-js CircleCI

A library with common function implementations for Javascript Applications.

Usage

With Webpack

If your application uses some module bundler, you can import the whole Commons-js library, a single module, or just a single function, making your source code smaller because only the features you need will be concatened to your build application.

The examples below were tested using Webpack, if you use another module bundler things might not work as well as expected.

ES Modules (Recommended)

Import the whole library and use it on your app:

import { commons } from '@linx-impulse/commons-js';

// make an ajax request
commons.http.ajax({
  url: 'http://www.google.com',
  callback: () => {
    console.log('OK');
  }
});

Import just the Http module. Only the implementation of this module functions will be bundled to your application source code.

import { http } from '@linx-impulse/commons-js/http';

// make an ajax request
http.ajax({
  url: 'http://www.google.com',
  callback: () => {
    console.log('OK');
  }
});

Import just the ajax function. Only the implementation of this function will be bundled to your application source code.

import { ajax } from '@linx-impulse/commons-js/http/ajax';

// make an ajax request
ajax({
  url: 'http://www.google.com',
  callback: () => {
    console.log('OK');
  }
});

CommonJS Modules

The Commons always exports the main module/function as default export of a file, so if your application uses CommonJS syntax, you can require the default module of each file.

Examples:

Require the whole library and use it on your app:

const commons = require('@linx-impulse/commons-js');

// make an ajax request
commons.http.ajax({
  url: 'http://www.google.com',
  callback: () => {
    console.log('OK');
  }
});

Require just the Http module. Only the implementation of this module functions will be bundled to your application source code.

const http = require('@linx-impulse/commons-js/http');

// make an ajax request
http.ajax({
  url: 'http://www.google.com',
  callback: () => {
    console.log('OK');
  }
});

Require just the ajax function. Only the implementation of this function will be bundled to your application source code.

const ajax = require('@linx-impulse/commons-js/http/ajax');

// make an ajax request
ajax({
  url: 'http://www.google.com',
  callback: () => {
    console.log('OK');
  }
});

Contributing

Code Style

We follow Airbnb JavaScript Style Guide and use eslint to validate the code. Before push a commit please run npm run lint to validate your code.

Commit Message Guidelines

We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate our change log.

The Commit Message Guidelines are documented here: https://share.linx.com.br/x/0txLAg.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.