JS文本差分 Jsdiff

码农软件 · 软件分类 · 其他开发相关 · 2019-10-18 16:57:22

软件介绍

Jsdiff是一款实现javascript文本差分的软件。

安装:

npm install diff

或者

bower install jsdiff

API

  • JsDiff.diffChars(oldStr, newStr[, options]) - diffs two blocks of text, comparing character by character.

    Returns a list of change objects (See below).

  • JsDiff.diffWords(oldStr, newStr[, options]) - diffs two blocks of text, comparing word by word, ignoring whitespace.

    Returns a list of change objects (See below).

  • JsDiff.diffWordsWithSpace(oldStr, newStr[, options]) - diffs two blocks of text, comparing word by word, treating whitespace as significant.

    Returns a list of change objects (See below).

  • JsDiff.diffLines(oldStr, newStr[, options]) - diffs two blocks of text, comparing line by line.

选择:

  • ignoreWhitespace: true to ignore leading and trailing whitespace. This is the same as diffTrimmedLines

  • newlineIsToken: true to treat newline characters as separate tokens.  This allows for changes to the newline structure to occur independently of the line content and to be treated as such. In general this is the more human

  • dly form of diffLines and diffLines is better suited for patches and other computer friendly output.

兼容性:

 Jsdiff支持所有ES3环境和IE8以下一些已知问题。这些浏览器存在一些差异算法,如文字diff和其他可能由于缺乏拆分操作捕获组支持的失败操作。

本文地址:https://codercto.com/soft/d/17040.html

中国游戏风云

中国游戏风云

王亚晖 / 中国发展出版社 / 2018-11-1 / 168.00元

本书以时间为序,介绍了整个游戏产业发展的跌宕起伏。分别讲述了早期游戏市场、单机游戏、网络游戏、网页游戏和手机游戏以及未来游戏世界。作者本人曾为知名游戏产业人,书中披露了大量不为大众所知的行业故事和行业数据。为游戏的制作者、投资人、玩家,抑或想了解游戏的人,提供了一个理性的梳理。一起来看看 《中国游戏风云》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

在线进制转换器
在线进制转换器

各进制数互转换器

随机密码生成器
随机密码生成器

多种字符组合密码