npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@leonwerth/vue-diff

v1.1.38

Published

Vue diff

Downloads

231

Readme

vue-diff 对比两个 html 字符串

合并两个 html 字符串, 不删除两边任何字符, 合并所有修改、删除、新增部分并标记

参数: perv: string current: string 返回: 合并的 html 字符串

concatHTML(prev, current)

对比两个 html 字符串,对新增部分进行标记

参数: perv: string current: string 返回: 两个 html 字符串不同部分的字符串(新增部分添加节点进行标识)

diffScreens(prev, current)

两屏对比不要颜色

参数: html1: string html2: string 返回: 合并后的 html: str

concatHTMLWithoutColor(html1: string, html2: string)

两屏对比塞入颜色

参数: html1: string html2: string 返回: { newHTML1: 标记新增、修改删除后的 html1, newHTML2: 标记新增、修改删除后的 html2, Diffs: 差异部分(包含[Diffs:差异列表,DiffsCount:差异数量]) }

compareHTML(html1: string, html2: string)

两屏对比函数的方法,对有差异的部分进行去重和数量计算

参数: isDiffs: 有差异的部分 返回: [Diffs:差异列表,DiffsCount:差异数量

uniqText(isDiffs)

两屏对比函数的方法,用来计算删除、新增、编辑的数量

参数: arr: 有差异的部分, idx: 在解析 HTML 中的第几行, id: 标记的节点id(给有差异的部分添加 div 标签,标签的 id 部分) 返回: [ Diffs:差异列表,DiffsCount:差异数量 ]

computeTypes(arr: Array, idx: number, id: string)

计算两个文本的差异部分

参数: perv: string current: string 返回: [[0, '修改部分']] 0没有修改 1新增 -1删除

getDiffArr(prev: string, current: string)

问题

1 npm install 安装不上(vite 和 vitejs/plugin-vue 的版本不兼容) npm install --force 强制安装 2 同屏滚动卡顿 因为左边滚动给右边赋值的时候右边又给左边赋值导致卡顿。 3 打包时不对 ts 做检查 package.json 中 修改 "build": "vue-tsc --noEmit -skipLibCheck && vite build" 为 vite build 4 对比出有一半的标签 对 >123< 尖括号内的字符串匹配