1.0.2 • Published 4 years ago

prepend-to-lines v1.0.2

Weekly downloads
17
License
-
Repository
github
Last release
4 years ago

prepend-to-lines



Prepends a string to each line of another string.

Installation

npm install --save prepend-to-lines@^1.0.2

yarn add prepend-to-lines@^1.0.2


(if configured properly)

npm install --save @jaid/prepend-to-lines@^1.0.2

Example

import prependToLines from "prepend-to-lines"

const text = "I\nwant\nto\nbe\na\nMarkdown\nlist"
const result = prependToLines(text, "- ")

const linesArray = ["Hello", "world"]
const result2 = prependToLines(linesArray, "x")

const result3 = prependToLines("Without linebreaks", "* ")

Variable result will be:

"- I\n- want\n- to\n- be\n- a\n- Markdown\n- list"

Variable result2 will be:

"xHello\nxworld"

Variable result3 will be:

"* Without linebreaks"

Development

Setting up:

git clone git@github.com:jaid/prepend-to-lines.git
cd prepend-to-lines
npm install

Testing:

npm run test:dev

Testing in production environment:

npm run test

License

MIT License
Copyright © 2020, Jaid \jaid.jsx@gmail.com (https://github.com/jaid)