f-xyz-diff
Version:
Difference between two arrays|strings.
2 lines • 1.51 kB
JavaScript
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.diff=e()}}(function(){return function e(n,r,t){function o(i,u){if(!r[i]){if(!n[i]){var d="function"==typeof require&&require;if(!u&&d)return d(i,!0);if(f)return f(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var a=r[i]={exports:{}};n[i][0].call(a.exports,function(e){var r=n[i][1][e];return o(r?r:e)},a,a.exports,e,n,r,t)}return r[i].exports}for(var f="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(e,n,r){"use strict";function t(){return s++}function o(e,n){return void 0!==e?e:n}function f(e,n){for(var r={},t=0;t<e.length;++t){var o=e[t];r[o[n]]=t}return r}function i(e,n,r){function t(e,n,r,t){i.push({item:e,state:n,oldIndex:t,newIndex:r})}for(var i=[],s=0,c=0,p=f(e,r),v=f(n,r);s<e.length||c<n.length;){var h=e[s],x=n[c];if(s>=e.length)t(x,a,-1,c),++c;else if(c>=n.length)t(h,d,s,-1),++s;else if(h!==x){var g=o(v[h[r]],-1),E=o(p[x[r]],-1),y=-1===g,D=-1===E;y&&(t(h,d,s,-1),++s),y||D||(t(h,l,s,E),++s,++c),D&&(t(x,a,-1,c),++c)}else t(x,u,s,c),++s,++c}return i}var u=0,d=1,l=2,a=-1,s=0;i.NOT_MODIFIED=u,i.CREATED=d,i.MOVED=l,i.DELETED=a,i.getUniqueId=t,i.buildHashToIndexMap=f,n.exports=i},{}]},{},[1])(1)});
//# sourceMappingURL=f-xyz-diff-0.1.22.min.js.map