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

C语言的科学和艺术

C语言的科学和艺术

罗伯茨 / 翁惠玉 / 机械工业出版社 / 2005-3 / 55.00元

《C语言的科学和艺术》是计算机科学的经典教材,介绍了计算机科学的基础知识和程序设计的专门知识。《C语言的科学和艺术》以介绍ANSI C为主线,不仅涵盖C语言的基本知识,而且介绍了软件工程技术以及如何应用良好的程序设计风格进行开发等内容。《C语言的科学和艺术》采用了库函数的方法,强调抽象的原则,详细阐述了库和模块化开发。此外,《C语言的科学和艺术》还利用大量实例讲述解决问题的全过程,对开发过程中常见......一起来看看 《C语言的科学和艺术》 这本书的介绍吧!

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具