UNPKG

@ff0000-ad-tech/ad-velvet

Version:

[![npm (tag)](https://img.shields.io/npm/v/@ff0000-ad-tech%2Fad-velvet.svg?style=flat-square)](https://www.npmjs.com/package/@ff0000-ad-tech%2Fad-velvet) [![GitHub issues](https://img.shields.io/github/issues/ff0000-ad-tech/ad-velvet.svg?style=flat-square

15 lines (14 loc) 480 B
/** * @memberOf Velvet * @method convertBreaks * @param {string} str * The string to convert * @description * Converts the string new line and return characters to html break tags * @example * // Get the string from Velvet * var myString = Velvet.get('myString') // "This Is\r\nMy Sentence" * // convert to html friendly * myString = Velvet.convertBreaks(myString) // "This Is<br>My Sentence" */ export const convertBreaks = str => str.replace(/\r?\n|\r/g, '<br>')