🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

html-str-replace

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-str-replace

replace string for html

Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

HtmlStrRep for html string repalce with keywords

HtmlStrRep install

  npm install html-str-replace --save

HtmlStrRep for ES6


  import HtmlStrRep from 'html-str-replace'
  const strRep = new HtmlStrRep()

  /*
  * str: Origin string (原始字符串)
  * sFrom: will be repalce this string (被替换的字符串)
  * sTo:  sFrom => sTo
  * */
  let endStr = strRep.startRep(str, sFrom, sTo)
  console.log(endStr)
  
  // for example
  let newStr = strRep.startRep('<div><a href="www.hansin.com">hansin</a><div>hansinhu</div></div>', 'han', '<span style="color: red;">han<span>')
  console.log(newStr)

update:

npm login
// 用户名:hansin
// 密码:****
// 邮箱:hansincn@gmail.com 
npm version patch 
npm publish

Keywords

replace

FAQs

Package last updated on 31 May 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