Need private packages and team management tools?Check out npm Teams »

breaklines

1.0.1 • Public • Published

Breaklines

A simple utility to add <br> tags into strings containing \n.

Created as my first NPM module, I've needed to create this when building static sites through Wintersmith, as when creating pages via .json files the newlines were not displayed.
Calling this function allowed them to be displayed correctly.

Install

$ npm install breaklines --save

Usage

const breaklines = require('breaklines');
const string = 'Testing \n adding \n\n newlines';
console.log(breaklines(string));
//=> 'Testing <br> adding <br><br> newlines'

Install

npm i breaklines

DownloadsWeekly Downloads

9

Version

1.0.1

License

ISC

Unpacked Size

1.44 kB

Total Files

4

Last publish

Collaborators

  • avatar
  • avatar