Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

extract-a

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extract-a

extract a element from a string

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

库的功能

一个含有a标签的字符串,解析出元素,

使用

let mockStr = `您的快件<a href="www.baidu.com" target="_blank" >zjs2u38u28347</a>已经发出,
如果需要查询,请访问我们的<a href="www.sina.com" target="_blank" >网站</a>或微信咨询,或官方渠道`;

const { extractA } = require('extract-a');
let nodesArray = extractA(mockStr);
console.log(nodesArray);

测试

// npm run test

输入=>
您的快件<a href="www.baidu.com" target="_blank" >zjs2u38u28347</a>已经发出,
如果需要查询,请访问我们的<a href="www.sina.com" target="_blank" >网站</a>或微信咨询,或官方渠道

输出=>
[ { type: 'text', content: '您的快件' },
  { type: 'link', content: 'zjs2u38u28347', href: 'www.baidu.com' },
  { type: 'text', content: '已经发出,\n如果需求查询,请访问我们的' },
  { type: 'link', content: '网站', href: 'www.sina.com' },
  { type: 'text', content: '或微信咨询,或官方聚到' } ]

todo

Keywords

FAQs

Package last updated on 13 May 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc