0.1.0 • Published 4 years ago

@drodsou/str-first-diff v0.1.0

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

@drodsou/str-first-diff

Gives information on the first difference of two strings.

installation

npm install @drodsou/str-first-diff

usage

const strFirstDiff = require '@drodsou/str-fist-diff';
let diff = strFirstDiff('some string', 'some Xtring');
if (diff) {
  console.log(diff.msg);
  /*
    Diff found at position 5 (line 1:6):

    some string
    -----|
    some Xtring

    Expected [s] charCode: 115, tested [X] charCode 88
  */
}

see ret object in index.js for complete list of returning fields

examples

see index.test.js