node package manager

cermati-utils

shared-utils

contains all the common libraries that may be used across different repository

All the code in this repository is copyrighted by Cermati.com (Dwi Cermat Pte Ltd)

Worksheet Reader example

var xlsx = require('xlsx');
var workbook = xlsx.readFile('./filename.xlsx');
var WorksheetReader = require('cermati-utils/WorksheetReader');

var SheetNames = {
    Sheet1: 'Sheet1'
};

var reader = new WorksheetReader(workbook.Sheets[SheetNames.Sheet1], {
        name: 'F'
    },
    'name'
);

var companyNames = reader.getAll();

Logger example

var logger = require('cermati-utils/logger')(__filename);

Slack example

var Slack = require('cermati-utils/slack');
var slack = new Slack({
  webhookUrl: 'https://hooks.slack.com/services/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',
  channel: 'insurance_payment',
  username: 'Test',
  emoji: ':moneybag:'
});

// this one return Promise
slack.send('Your message here');

Set ENV variables

var logger = require('cermati-utils/setEnv');

This script will set the ENV variables from the .env file in the current directory.

Use DOTENV_PATH parameter to use .env file from other directory.

Example:

$ DOTENV_PATH=./tests/.env node index.js