Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

beauty-amp-core

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beauty-amp-core

Beautify (prettify) AMPscript for Marketing Cloud - prettifying library only.

  • 0.3.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
798
increased by102.54%
Maintainers
1
Weekly downloads
 
Created
Source

BEAUTY AMP CORE

This library gives you the option to format AMPscript code used in SFMC.

Installation

> npm install --save beauty-amp-core

Usage

const beautifier = require('beauty-amp-core');

beautifier.setup(undefined, undefined, {
  loggerOn: false
});

let lines = [`<h1>My Test Case:</h1>`,
`%%[ VAR @lang `,
`If (@lang == 'EN') then Output("Hello World!")`,
`Else`,
`	Output("Ciao!")`,
`endif`,
`]%%`];

const result = beautifier.beautify(lines);
console.log(result); // returns code as an array

beautify(lines)

Format code. Lines are broken on "\n".
lines: Array|String - text of your code
return: {Array|String} Formatted code. Array or string based on the initial input.

Setup

Defaults:

// immutable at the moment:
const ampscript = {
  capitalizeAndOrNot:true,
  capitalizeIfFor:true,
  capitalizeSet:true,
  capitalizeVar:true,
  maxParametersPerLine: 4
};
// immutable at the moment:
const editor = {
  insertSpaces: true
};
// logs trough console only for the moment.
const logs = {
  loggerOn: true // <= disable logging
};

beautifier.setup(ampscript, editor, logs);

FAQs

Package last updated on 28 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc