| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This is part of jsdifflib v1.0. <http://snowtide.com/jsdifflib> | 2 * This is part of jsdifflib v1.0. <http://snowtide.com/jsdifflib> |
| 3 * | 3 * |
| 4 * Copyright (c) 2007, Snowtide Informatics Systems, Inc. | 4 * Copyright (c) 2007, Snowtide Informatics Systems, Inc. |
| 5 * All rights reserved. | 5 * All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without modificati
on, | 7 * Redistribution and use in source and binary forms, with or without modificati
on, |
| 8 * are permitted provided that the following conditions are met: | 8 * are permitted provided that the following conditions are met: |
| 9 * | 9 * |
| 10 * * Redistributions of source code must retain the above copyright notice, t
his | 10 * * Redistributions of source code must retain the above copyright notice, t
his |
| 11 * list of conditions and the following disclaimer. | 11 * list of conditions and the following disclaimer. |
| 12 * * Redistributions in binary form must reproduce the above copyright notice
, | 12 * * Redistributions in binary form must reproduce the above copyright notice
, |
| 13 * this list of conditions and the following disclaimer in the documentation | 13 * this list of conditions and the following disclaimer in the documentation |
| 14 * and/or other materials provided with the distribution. | 14 * and/or other materials provided with the distribution. |
| 15 * * Neither the name of the Snowtide Informatics Systems nor the names of it
s | 15 * * Neither the name of the Snowtide Informatics Systems nor the names of it
s |
| 16 * contributors may be used to endorse or promote products derived from this | 16 * contributors may be used to endorse or promote products derived from this |
| 17 * software without specific prior written permission. | 17 * software without specific prior written permission. |
| 18 * | 18 * |
| 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" A
ND ANY | 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" A
ND ANY |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // returns a function that returns true if a key passed to the returned func
tion | 89 // returns a function that returns true if a key passed to the returned func
tion |
| 90 // is in the dict (js object) provided to this function; replaces being able
to | 90 // is in the dict (js object) provided to this function; replaces being able
to |
| 91 // carry around dict.has_key in python... | 91 // carry around dict.has_key in python... |
| 92 __isindict: function (dict) { | 92 __isindict: function (dict) { |
| 93 return function (key) { return dict.hasOwnProperty(key); }; | 93 return function (key) { return dict.hasOwnProperty(key); }; |
| 94 }, | 94 }, |
| 95 | 95 |
| 96 // replacement for python's dict.get function -- need easy default values | 96 // replacement for python's dict.get function -- need easy default values |
| 97 __dictget: function (dict, key, defaultValue) { | 97 __dictget: function (dict, key, defaultValue) { |
| 98 return dict.hasOwnProperty(key) ? dict[key] : defaultValue; | 98 return dict.hasOwnProperty(key) ? dict[key] : defaultValue; |
| 99 }, | 99 }, |
| 100 | 100 |
| 101 SequenceMatcher: function (a, b, isjunk) { | 101 SequenceMatcher: function (a, b, isjunk) { |
| 102 this.set_seqs = function (a, b) { | 102 this.set_seqs = function (a, b) { |
| 103 this.set_seq1(a); | 103 this.set_seq1(a); |
| 104 this.set_seq2(b); | 104 this.set_seq2(b); |
| 105 } | 105 } |
| 106 | 106 |
| 107 this.set_seq1 = function (a) { | 107 this.set_seq1 = function (a) { |
| 108 if (a == this.a) return; | 108 if (a == this.a) return; |
| 109 this.a = a; | 109 this.a = a; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 var la = this.a.length; | 400 var la = this.a.length; |
| 401 var lb = this.b.length; | 401 var lb = this.b.length; |
| 402 return _calculate_ratio(Math.min(la, lb), la + lb); | 402 return _calculate_ratio(Math.min(la, lb), la + lb); |
| 403 } | 403 } |
| 404 | 404 |
| 405 this.isjunk = isjunk ? isjunk : difflib.defaultJunkFunction; | 405 this.isjunk = isjunk ? isjunk : difflib.defaultJunkFunction; |
| 406 this.a = this.b = null; | 406 this.a = this.b = null; |
| 407 this.set_seqs(a, b); | 407 this.set_seqs(a, b); |
| 408 } | 408 } |
| 409 } | 409 } |
| OLD | NEW |