e360-ssjs-lib
v0.0.2
Published
e360-ssjs-lib package to use with the ssjs framework
Downloads
6
Maintainers
Readme
Email360 ssjs-lib
This is a packaged version of the Email360 ssjs-lib, designed for compatibility with the SSJS Framework. It serves as a wrapper around the original library, with methods exported as modules through a custom loader. If you're interested in contributing to the core library, please visit the original repository.
Install
Follow the original installation guide to set up the library. To install it in your project, use the following command:
npm install e360-ssjs-lib
Usage
Import single functions without importing the whole library You can import individual functions without loading the entire library, which reduces the overall bundle size. The loader will take care of the dependecies. e.g. jwt is dependant on lib_amp, lib_core, lib_sfmcapi, lib_wsproxy, lib_logger and lib_polyfill. So importing jwt will also import those dependencies.
import { logger } from 'e360-ssjs-lib/lib_logger'
const l = new logger("dev");
l.level = "INFO";
l.info("test")
Import from the entire library This will import and expose the named function, but it will also import everything else from the library.
import { getUnixTimestamp } from 'e360-ssjs-lib';
const timestamp = getUnixTimestamp();
Import only polyfills To import just the polyfills, use the following code:
import 'e360-ssjs-lib/lib_polyfills';
const arr = [1,2,3];
const sum = arr.reduce((acc, curr) => {
return acc + curr;
}, 0);