1.3.18 • Published 3 years ago

multilinejavascriptconverter v1.3.18

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

Coverage Status

Multiline JavaScript Converter

Description

Multiline JavaScript Converter is a tool to convert strings into JavaScript safe text. It is able to account for new lines, special characters and able to produce multiple string types.

Demo of Multiline JavaScript Converter

Standalone Library

Multiline JavaScript Converter can also be used as an NPM library.

NPM

npm install --save-dev multilinejavascriptconverter

Yarn

yarn install --save multilinejavascriptconverter

Import

Inside your Node project:

    var msc = require('multilinejavascriptconverter');
    var input = [
        'line1',
        'line2',
        'line3',
        'line4',
        'line5',
    ];
    var output = msc.convertText('output', input, msc.ECMA5_DOUBLE, false, true, false, msc.TABS);
    console.log(output);

    /* Expected output:
        var output = "line1" +
          "line2" +
          "line3" +
          "line4" +
          "line5"
    */

Documentation

Note: All fields are required.

Field #Field NameValid Values
1Variable nameAny string
2Input variablesString separated by '\n' (Newline) or Array
3String typeECMA_DOUBLE/ECMA_SINGLE/ECMA6/JSON_DOUBLE
4Add new linestrue/false
5Trim whitespacetrue/false
6Semicolon (N/A for JSON_DOUBLE)true/false
7SpacesTAB/SPACES_2/SPACES_4/SPACES_8

Below constants can be imported from the library:

  • String types: ECMA_DOUBLE/ECMA_SINGLE/ECMA6/JSON_DOUBLE
  • Space types: TAB/SPACES_2/SPACES_4/SPACES_8

Getting setup

  1. Download repository
  2. Run npm install
  3. Run npm run setup to install dependencies

Build all

npm run build

Run site

npm run serve

Compile JS

Full JS compile

npm run js

Import all components

npm run js:build

Convert to ECMA5 code and minify

npm run js:compile

Compile CSS

npm run css

Compile HTML

npm run html

Tests

Run all tests

npm run test

Run ESLLint

npm run linter

Mocha

npm run mocha

Run E2E tests

Run the below the first time:

npm run selenium-setup

The below must be running every time tests are run:

npm run serve node_modules/.bin/chromedriver

To run the tests run the below:

npm run nightwatch

Built with

Bugs and suggestions

If you find any bugs or have any suggestions on how to improve Multiline JavaScript Converter please post in the Github issues.

1.3.18

3 years ago

1.3.11

4 years ago

1.3.7

5 years ago

1.3.5

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago