New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

update-generated-text

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

update-generated-text

Update or append a block of generated text.

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Update Generated Text

Update or append a block of generated text.

Append Example

import updateGeneratedText from 'update-generated-text'

const startString = '# _Start_Generated_Text'
const endString = '# _End_Generated_Text'

const newContents = '
coverage
.tmp
'

const text = `
# Gitignore
./.DS_Store
`

const newText = updateGeneratedText(
  startString,
  endString,
  newContents,
  text
)

/*
  # Gitignore
  ./.DS_Store

  # _Start_Generated_Text
  coverage
  .tmp
  # _End_Generated_Text
*/
console.log(newText)

Replace Example

import updateGeneratedText from 'update-generated-text'

const startString = '# _Start_Generated_Text'
const endString = '# _End_Generated_Text'

const newContents = '
coverage
.tmp
'

const text = `
# Gitignore

# _Start_Generated_Text
lib
# _End_Generated_Text

./.DS_Store
`

const newText = updateGeneratedText(
  startString,
  endString,
  newContents,
  text
)

/*
  # Gitignore

  # _Start_Generated_Text
  coverage
  .tmp
  # _End_Generated_Text

  ./.DS_Store
*/
console.log(newText)

FAQs

Package last updated on 21 Dec 2018

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