locutus 2.0.31 → 2.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -0
- package/_data/rosetta.yml +325 -0
- package/awk/builtin/index.js +3 -0
- package/awk/builtin/int.js +13 -0
- package/awk/builtin/length.js +16 -0
- package/awk/builtin/substr.js +23 -0
- package/c/ctype/index.js +8 -0
- package/c/ctype/isalnum.js +15 -0
- package/c/ctype/isalpha.js +17 -0
- package/c/ctype/isdigit.js +15 -0
- package/c/ctype/islower.js +15 -0
- package/c/ctype/isspace.js +15 -0
- package/c/ctype/isupper.js +15 -0
- package/c/ctype/tolower.js +15 -0
- package/c/ctype/toupper.js +15 -0
- package/c/index.js +2 -5
- package/c/math/abs.js +14 -18
- package/c/math/frexp.js +19 -20
- package/c/math/index.js +2 -5
- package/c/stdio/index.js +1 -4
- package/c/stdio/sprintf.js +71 -81
- package/c/stdlib/atof.js +15 -0
- package/c/stdlib/atoi.js +17 -0
- package/c/stdlib/index.js +2 -0
- package/c/string/index.js +5 -0
- package/c/string/strcat.js +12 -0
- package/c/string/strchr.js +15 -0
- package/c/string/strcmp.js +21 -0
- package/c/string/strlen.js +12 -0
- package/c/string/strstr.js +15 -0
- package/clojure/Math/abs.js +13 -0
- package/clojure/Math/ceil.js +15 -0
- package/clojure/Math/floor.js +14 -0
- package/clojure/Math/index.js +3 -0
- package/elixir/Float/ceil.js +16 -0
- package/elixir/Float/floor.js +14 -0
- package/elixir/Float/index.js +2 -0
- package/elixir/Kernel/abs.js +13 -0
- package/elixir/Kernel/index.js +1 -0
- package/golang/index.js +1 -4
- package/golang/strconv/Atoi.js +26 -0
- package/golang/strconv/FormatBool.js +12 -0
- package/golang/strconv/FormatInt.js +21 -0
- package/golang/strconv/Itoa.js +14 -0
- package/golang/strconv/ParseBool.js +35 -0
- package/golang/strconv/ParseInt.js +27 -0
- package/golang/strconv/index.js +6 -0
- package/golang/strings/Compare.js +19 -0
- package/golang/strings/Contains.js +7 -9
- package/golang/strings/ContainsAny.js +18 -0
- package/golang/strings/Count.js +20 -22
- package/golang/strings/EqualFold.js +13 -0
- package/golang/strings/Fields.js +12 -0
- package/golang/strings/HasPrefix.js +15 -0
- package/golang/strings/HasSuffix.js +20 -0
- package/golang/strings/Index.js +11 -0
- package/golang/strings/Index2.js +9 -11
- package/golang/strings/IndexAny.js +18 -0
- package/golang/strings/Join.js +16 -0
- package/golang/strings/LastIndex.js +10 -12
- package/golang/strings/LastIndexAny.js +18 -0
- package/golang/strings/Repeat.js +19 -0
- package/golang/strings/Replace.js +44 -0
- package/golang/strings/Split.js +24 -0
- package/golang/strings/ToLower.js +9 -0
- package/golang/strings/ToUpper.js +9 -0
- package/golang/strings/Trim.js +19 -0
- package/golang/strings/TrimLeft.js +15 -0
- package/golang/strings/TrimPrefix.js +14 -0
- package/golang/strings/TrimRight.js +15 -0
- package/golang/strings/TrimSpace.js +10 -0
- package/golang/strings/TrimSuffix.js +14 -0
- package/golang/strings/index.js +25 -7
- package/index.js +5 -8
- package/julia/Base/abs.js +13 -0
- package/julia/Base/ceil.js +16 -0
- package/julia/Base/floor.js +14 -0
- package/julia/Base/index.js +3 -0
- package/lua/math/abs.js +13 -0
- package/lua/math/ceil.js +16 -0
- package/lua/math/floor.js +14 -0
- package/lua/math/index.js +3 -0
- package/package.json +37 -51
- package/perl/POSIX/ceil.js +16 -0
- package/perl/POSIX/floor.js +14 -0
- package/perl/POSIX/index.js +2 -0
- package/perl/core/index.js +1 -0
- package/perl/core/length.js +16 -0
- package/php/_helpers/_bc.js +524 -515
- package/php/_helpers/_phpCastString.js +20 -25
- package/php/_helpers/_php_cast_float.js +5 -10
- package/php/_helpers/_php_cast_int.js +6 -11
- package/php/_helpers/index.js +4 -7
- package/php/array/array_change_key_case.js +11 -16
- package/php/array/array_chunk.js +20 -23
- package/php/array/array_column.js +22 -72
- package/php/array/array_combine.js +13 -18
- package/php/array/array_count_values.js +35 -39
- package/php/array/array_diff.js +11 -14
- package/php/array/array_diff_assoc.js +11 -14
- package/php/array/array_diff_key.js +11 -14
- package/php/array/array_diff_uassoc.js +15 -19
- package/php/array/array_diff_ukey.js +14 -17
- package/php/array/array_fill.js +11 -13
- package/php/array/array_fill_keys.js +5 -8
- package/php/array/array_filter.js +12 -13
- package/php/array/array_flip.js +13 -15
- package/php/array/array_intersect.js +13 -16
- package/php/array/array_intersect_assoc.js +13 -16
- package/php/array/array_intersect_key.js +15 -18
- package/php/array/array_intersect_uassoc.js +17 -20
- package/php/array/array_intersect_ukey.js +17 -20
- package/php/array/array_key_exists.js +4 -7
- package/php/array/array_keys.js +22 -24
- package/php/array/array_map.js +24 -29
- package/php/array/array_merge.js +22 -25
- package/php/array/array_merge_recursive.js +51 -27
- package/php/array/array_multisort.js +138 -130
- package/php/array/array_pad.js +24 -26
- package/php/array/array_pop.js +10 -13
- package/php/array/array_product.js +15 -17
- package/php/array/array_push.js +16 -19
- package/php/array/array_rand.js +11 -14
- package/php/array/array_reduce.js +11 -14
- package/php/array/array_replace.js +9 -12
- package/php/array/array_replace_recursive.js +20 -24
- package/php/array/array_reverse.js +12 -15
- package/php/array/array_search.js +27 -29
- package/php/array/array_shift.js +3 -6
- package/php/array/array_slice.js +37 -39
- package/php/array/array_splice.js +64 -69
- package/php/array/array_sum.js +7 -12
- package/php/array/array_udiff.js +14 -17
- package/php/array/array_udiff_assoc.js +14 -17
- package/php/array/array_udiff_uassoc.js +17 -20
- package/php/array/array_uintersect.js +16 -19
- package/php/array/array_uintersect_uassoc.js +18 -21
- package/php/array/array_unique.js +12 -15
- package/php/array/array_unshift.js +4 -7
- package/php/array/array_values.js +11 -13
- package/php/array/array_walk.js +10 -15
- package/php/array/array_walk_recursive.js +15 -20
- package/php/array/arsort.js +50 -52
- package/php/array/asort.js +50 -51
- package/php/array/count.js +15 -14
- package/php/array/current.js +30 -32
- package/php/array/each.js +32 -35
- package/php/array/end.js +27 -30
- package/php/array/in_array.js +7 -10
- package/php/array/index.js +73 -76
- package/php/array/key.js +32 -34
- package/php/array/krsort.js +50 -51
- package/php/array/ksort.js +50 -51
- package/php/array/natcasesort.js +37 -38
- package/php/array/natsort.js +35 -36
- package/php/array/next.js +34 -36
- package/php/array/pos.js +10 -12
- package/php/array/prev.js +32 -34
- package/php/array/range.js +30 -33
- package/php/array/reset.js +24 -27
- package/php/array/rsort.js +47 -49
- package/php/array/shuffle.js +16 -18
- package/php/array/sizeof.js +3 -6
- package/php/array/sort.js +43 -45
- package/php/array/uasort.js +19 -21
- package/php/array/uksort.js +22 -24
- package/php/array/usort.js +20 -22
- package/php/bc/bcadd.js +16 -19
- package/php/bc/bccomp.js +12 -15
- package/php/bc/bcdiv.js +17 -20
- package/php/bc/bcmul.js +16 -19
- package/php/bc/bcround.js +21 -24
- package/php/bc/bcscale.js +8 -11
- package/php/bc/bcsub.js +16 -19
- package/php/bc/index.js +7 -10
- package/php/ctype/ctype_alnum.js +14 -16
- package/php/ctype/ctype_alpha.js +14 -16
- package/php/ctype/ctype_cntrl.js +9 -12
- package/php/ctype/ctype_digit.js +14 -16
- package/php/ctype/ctype_graph.js +14 -16
- package/php/ctype/ctype_lower.js +14 -16
- package/php/ctype/ctype_print.js +14 -16
- package/php/ctype/ctype_punct.js +14 -16
- package/php/ctype/ctype_space.js +9 -12
- package/php/ctype/ctype_upper.js +14 -16
- package/php/ctype/ctype_xdigit.js +14 -16
- package/php/ctype/index.js +11 -14
- package/php/datetime/checkdate.js +15 -17
- package/php/datetime/date.js +142 -123
- package/php/datetime/date_parse.js +18 -21
- package/php/datetime/getdate.js +38 -24
- package/php/datetime/gettimeofday.js +7 -10
- package/php/datetime/gmdate.js +17 -16
- package/php/datetime/gmmktime.js +23 -25
- package/php/datetime/gmstrftime.js +17 -14
- package/php/datetime/idate.js +44 -38
- package/php/datetime/index.js +15 -18
- package/php/datetime/microtime.js +11 -14
- package/php/datetime/mktime.js +14 -17
- package/php/datetime/strftime.js +122 -113
- package/php/datetime/strptime.js +210 -191
- package/php/datetime/strtotime.js +615 -496
- package/php/datetime/time.js +11 -13
- package/php/exec/escapeshellarg.js +16 -18
- package/php/exec/index.js +1 -4
- package/php/filesystem/basename.js +22 -24
- package/php/filesystem/dirname.js +12 -14
- package/php/filesystem/file_exists.js +12 -0
- package/php/filesystem/file_get_contents.js +3 -6
- package/php/filesystem/index.js +6 -8
- package/php/filesystem/pathinfo.js +47 -46
- package/php/filesystem/realpath.js +16 -19
- package/php/funchand/call_user_func.js +4 -7
- package/php/funchand/call_user_func_array.js +19 -22
- package/php/funchand/create_function.js +4 -7
- package/php/funchand/function_exists.js +4 -8
- package/php/funchand/get_defined_functions.js +25 -32
- package/php/funchand/index.js +5 -8
- package/php/i18n/i18n_loc_get_default.js +7 -10
- package/php/i18n/i18n_loc_set_default.js +12 -15
- package/php/i18n/index.js +2 -5
- package/php/index.js +20 -23
- package/php/info/assert_options.js +25 -27
- package/php/info/getenv.js +8 -10
- package/php/info/index.js +6 -9
- package/php/info/ini_get.js +9 -12
- package/php/info/ini_set.js +32 -34
- package/php/info/set_time_limit.js +8 -11
- package/php/info/version_compare.js +43 -44
- package/php/json/index.js +3 -6
- package/php/json/json_decode.js +42 -28
- package/php/json/json_encode.js +89 -66
- package/php/json/json_last_error.js +11 -13
- package/php/math/abs.js +2 -5
- package/php/math/acos.js +2 -5
- package/php/math/acosh.js +7 -9
- package/php/math/asin.js +2 -5
- package/php/math/asinh.js +7 -9
- package/php/math/atan.js +7 -9
- package/php/math/atan2.js +7 -9
- package/php/math/atanh.js +2 -5
- package/php/math/base_convert.js +8 -10
- package/php/math/bindec.js +12 -14
- package/php/math/ceil.js +7 -9
- package/php/math/cos.js +7 -9
- package/php/math/cosh.js +7 -9
- package/php/math/decbin.js +16 -18
- package/php/math/dechex.js +3 -6
- package/php/math/decoct.js +13 -15
- package/php/math/deg2rad.js +8 -10
- package/php/math/exp.js +7 -9
- package/php/math/expm1.js +9 -11
- package/php/math/floor.js +7 -9
- package/php/math/fmod.js +27 -29
- package/php/math/getrandmax.js +7 -9
- package/php/math/hexdec.js +10 -12
- package/php/math/hypot.js +8 -11
- package/php/math/index.js +46 -49
- package/php/math/is_finite.js +9 -14
- package/php/math/is_infinite.js +9 -14
- package/php/math/is_nan.js +8 -13
- package/php/math/lcg_value.js +8 -10
- package/php/math/log.js +8 -10
- package/php/math/log10.js +12 -14
- package/php/math/log1p.js +15 -17
- package/php/math/max.js +54 -59
- package/php/math/min.js +54 -59
- package/php/math/mt_getrandmax.js +7 -9
- package/php/math/mt_rand.js +15 -17
- package/php/math/octdec.js +8 -10
- package/php/math/pi.js +2 -5
- package/php/math/pow.js +2 -5
- package/php/math/rad2deg.js +8 -10
- package/php/math/rand.js +15 -17
- package/php/math/round.js +48 -49
- package/php/math/sin.js +7 -9
- package/php/math/sinh.js +7 -9
- package/php/math/sqrt.js +7 -9
- package/php/math/tan.js +7 -9
- package/php/math/tanh.js +8 -10
- package/php/misc/index.js +2 -5
- package/php/misc/pack.js +173 -165
- package/php/misc/uniqid.js +20 -23
- package/php/net-gopher/gopher_parsedir.js +27 -29
- package/php/net-gopher/index.js +1 -4
- package/php/network/index.js +6 -9
- package/php/network/inet_ntop.js +15 -15
- package/php/network/inet_pton.js +30 -34
- package/php/network/ip2long.js +25 -15
- package/php/network/long2ip.js +8 -10
- package/php/network/setcookie.js +11 -13
- package/php/network/setrawcookie.js +16 -19
- package/php/pcre/index.js +4 -7
- package/php/pcre/preg_match.js +3 -6
- package/php/pcre/preg_quote.js +2 -5
- package/php/pcre/preg_replace.js +8 -11
- package/php/pcre/sql_regcase.js +17 -20
- package/php/strings/addcslashes.js +86 -88
- package/php/strings/addslashes.js +15 -16
- package/php/strings/bin2hex.js +19 -43
- package/php/strings/chop.js +8 -10
- package/php/strings/chr.js +12 -14
- package/php/strings/chunk_split.js +15 -17
- package/php/strings/convert_cyr_string.js +137 -50
- package/php/strings/convert_uuencode.js +35 -38
- package/php/strings/count_chars.js +29 -27
- package/php/strings/crc32.js +276 -21
- package/php/strings/echo.js +28 -30
- package/php/strings/explode.js +31 -26
- package/php/strings/get_html_translation_table.js +123 -122
- package/php/strings/hex2bin.js +21 -21
- package/php/strings/html_entity_decode.js +31 -33
- package/php/strings/htmlentities.js +38 -34
- package/php/strings/htmlspecialchars.js +20 -23
- package/php/strings/htmlspecialchars_decode.js +19 -21
- package/php/strings/implode.js +23 -27
- package/php/strings/index.js +91 -94
- package/php/strings/join.js +8 -10
- package/php/strings/lcfirst.js +9 -11
- package/php/strings/levenshtein.js +37 -39
- package/php/strings/localeconv.js +12 -15
- package/php/strings/ltrim.js +12 -14
- package/php/strings/md5.js +216 -223
- package/php/strings/md5_file.js +17 -19
- package/php/strings/metaphone.js +112 -117
- package/php/strings/money_format.js +139 -126
- package/php/strings/nl2br.js +24 -26
- package/php/strings/nl_langinfo.js +32 -35
- package/php/strings/number_format.js +19 -22
- package/php/strings/ord.js +19 -21
- package/php/strings/parse_str.js +53 -56
- package/php/strings/printf.js +6 -9
- package/php/strings/quoted_printable_decode.js +7 -10
- package/php/strings/quoted_printable_encode.js +19 -20
- package/php/strings/quotemeta.js +7 -9
- package/php/strings/rtrim.js +14 -16
- package/php/strings/setlocale.js +148 -104
- package/php/strings/sha1.js +108 -106
- package/php/strings/sha1_file.js +15 -17
- package/php/strings/similar_text.js +34 -33
- package/php/strings/soundex.js +34 -36
- package/php/strings/split.js +8 -10
- package/php/strings/sprintf.js +112 -114
- package/php/strings/sscanf.js +99 -96
- package/php/strings/str_getcsv.js +37 -32
- package/php/strings/str_ireplace.js +50 -55
- package/php/strings/str_pad.js +18 -21
- package/php/strings/str_repeat.js +14 -16
- package/php/strings/str_replace.js +32 -37
- package/php/strings/str_rot13.js +15 -17
- package/php/strings/str_shuffle.js +12 -15
- package/php/strings/str_split.js +19 -21
- package/php/strings/str_word_count.js +51 -50
- package/php/strings/strcasecmp.js +12 -14
- package/php/strings/strchr.js +10 -12
- package/php/strings/strcmp.js +12 -14
- package/php/strings/strcoll.js +9 -12
- package/php/strings/strcspn.js +30 -25
- package/php/strings/strip_tags.js +50 -52
- package/php/strings/stripos.js +12 -14
- package/php/strings/stripslashes.js +8 -10
- package/php/strings/stristr.js +15 -17
- package/php/strings/strlen.js +23 -26
- package/php/strings/strnatcasecmp.js +6 -8
- package/php/strings/strnatcmp.js +47 -46
- package/php/strings/strncasecmp.js +30 -32
- package/php/strings/strncmp.js +5 -7
- package/php/strings/strpbrk.js +12 -14
- package/php/strings/strpos.js +11 -13
- package/php/strings/strrchr.js +7 -10
- package/php/strings/strrev.js +188 -10
- package/php/strings/strripos.js +16 -18
- package/php/strings/strrpos.js +20 -22
- package/php/strings/strspn.js +24 -26
- package/php/strings/strstr.js +20 -22
- package/php/strings/strtok.js +14 -16
- package/php/strings/strtolower.js +8 -10
- package/php/strings/strtoupper.js +8 -10
- package/php/strings/strtr.js +38 -43
- package/php/strings/substr.js +14 -18
- package/php/strings/substr_compare.js +18 -20
- package/php/strings/substr_count.js +11 -14
- package/php/strings/substr_replace.js +5 -8
- package/php/strings/trim.js +53 -32
- package/php/strings/ucfirst.js +11 -13
- package/php/strings/ucwords.js +3 -6
- package/php/strings/vprintf.js +6 -9
- package/php/strings/vsprintf.js +8 -10
- package/php/strings/wordwrap.js +32 -35
- package/php/url/base64_decode.js +42 -40
- package/php/url/base64_encode.js +51 -53
- package/php/url/http_build_query.js +27 -32
- package/php/url/index.js +8 -11
- package/php/url/parse_url.js +61 -25
- package/php/url/rawurldecode.js +8 -8
- package/php/url/rawurlencode.js +9 -6
- package/php/url/urldecode.js +9 -8
- package/php/url/urlencode.js +11 -6
- package/php/var/boolval.js +31 -33
- package/php/var/doubleval.js +10 -12
- package/php/var/empty.js +11 -16
- package/php/var/floatval.js +13 -15
- package/php/var/gettype.js +22 -23
- package/php/var/index.js +30 -33
- package/php/var/intval.js +35 -39
- package/php/var/is_array.js +27 -31
- package/php/var/is_binary.js +2 -5
- package/php/var/is_bool.js +10 -12
- package/php/var/is_buffer.js +2 -5
- package/php/var/is_callable.js +34 -35
- package/php/var/is_double.js +10 -12
- package/php/var/is_float.js +12 -14
- package/php/var/is_int.js +20 -22
- package/php/var/is_integer.js +12 -14
- package/php/var/is_long.js +3 -6
- package/php/var/is_null.js +9 -11
- package/php/var/is_numeric.js +30 -6
- package/php/var/is_object.js +4 -9
- package/php/var/is_real.js +3 -6
- package/php/var/is_scalar.js +2 -8
- package/php/var/is_string.js +9 -11
- package/php/var/is_unicode.js +12 -15
- package/php/var/isset.js +9 -12
- package/php/var/print_r.js +49 -53
- package/php/var/serialize.js +47 -52
- package/php/var/serialize.vitest.ts +10 -0
- package/php/var/strval.js +10 -13
- package/php/var/unserialize.js +168 -202
- package/php/var/var_dump.js +105 -104
- package/php/var/var_export.js +64 -66
- package/php/xdiff/index.js +2 -5
- package/php/xdiff/xdiff_string_diff.js +240 -226
- package/php/xdiff/xdiff_string_patch.js +98 -93
- package/php/xml/index.js +2 -5
- package/php/xml/utf8_decode.js +40 -42
- package/php/xml/utf8_encode.js +40 -42
- package/python/index.js +1 -4
- package/python/math/ceil.js +17 -0
- package/python/math/exp.js +12 -0
- package/python/math/fabs.js +14 -0
- package/python/math/factorial.js +29 -0
- package/python/math/floor.js +14 -0
- package/python/math/gcd.js +23 -0
- package/python/math/index.js +15 -0
- package/python/math/isfinite.js +14 -0
- package/python/math/isinf.js +14 -0
- package/python/math/isnan.js +14 -0
- package/python/math/log.js +16 -0
- package/python/math/log10.js +14 -0
- package/python/math/log2.js +14 -0
- package/python/math/pow.js +14 -0
- package/python/math/sqrt.js +14 -0
- package/python/math/trunc.js +14 -0
- package/python/string/ascii_letters.js +14 -14
- package/python/string/ascii_lowercase.js +12 -16
- package/python/string/ascii_uppercase.js +12 -16
- package/python/string/capwords.js +4 -7
- package/python/string/digits.js +10 -0
- package/python/string/hexdigits.js +10 -0
- package/python/string/index.js +10 -8
- package/python/string/octdigits.js +10 -0
- package/python/string/printable.js +15 -0
- package/python/string/punctuation.js +5 -7
- package/python/string/whitespace.js +10 -0
- package/r/base/abs.js +13 -0
- package/r/base/ceiling.js +16 -0
- package/r/base/floor.js +14 -0
- package/r/base/index.js +3 -0
- package/ruby/Array/compact.js +18 -0
- package/ruby/Array/first.js +22 -0
- package/ruby/Array/flatten.js +22 -0
- package/ruby/Array/index.js +6 -0
- package/ruby/Array/last.js +22 -0
- package/ruby/Array/sample.js +31 -0
- package/ruby/Array/uniq.js +16 -0
- package/ruby/Math/acos.js +2 -5
- package/ruby/Math/asin.js +11 -0
- package/ruby/Math/atan.js +11 -0
- package/ruby/Math/cbrt.js +13 -0
- package/ruby/Math/cos.js +12 -0
- package/ruby/Math/cosh.js +11 -0
- package/ruby/Math/exp.js +11 -0
- package/ruby/Math/index.js +15 -4
- package/ruby/Math/log.js +11 -0
- package/ruby/Math/log10.js +13 -0
- package/ruby/Math/log2.js +13 -0
- package/ruby/Math/sin.js +12 -0
- package/ruby/Math/sinh.js +11 -0
- package/ruby/Math/sqrt.js +13 -0
- package/ruby/Math/tan.js +11 -0
- package/ruby/Math/tanh.js +11 -0
- package/ruby/String/capitalize.js +19 -0
- package/ruby/String/chomp.js +27 -0
- package/ruby/String/chop.js +25 -0
- package/ruby/String/downcase.js +10 -0
- package/ruby/String/end_with.js +17 -0
- package/ruby/String/include.js +12 -0
- package/ruby/String/index.js +11 -0
- package/ruby/String/length.js +12 -0
- package/ruby/String/reverse.js +12 -0
- package/ruby/String/start_with.js +14 -0
- package/ruby/String/strip.js +12 -0
- package/ruby/String/upcase.js +10 -0
- package/ruby/index.js +1 -4
- package/_util/cli.js +0 -14
- package/_util/cli.js.map +0 -1
- package/_util/util.js +0 -620
- package/_util/util.js.map +0 -1
- package/c/index.js.map +0 -1
- package/c/math/abs.js.map +0 -1
- package/c/math/frexp.js.map +0 -1
- package/c/math/index.js.map +0 -1
- package/c/stdio/index.js.map +0 -1
- package/c/stdio/sprintf.js.map +0 -1
- package/golang/index.js.map +0 -1
- package/golang/strings/Contains.js.map +0 -1
- package/golang/strings/Count.js.map +0 -1
- package/golang/strings/Index2.js.map +0 -1
- package/golang/strings/LastIndex.js.map +0 -1
- package/golang/strings/index.js.map +0 -1
- package/index.js.map +0 -1
- package/php/_helpers/_bc.js.map +0 -1
- package/php/_helpers/_phpCastString.js.map +0 -1
- package/php/_helpers/_php_cast_float.js.map +0 -1
- package/php/_helpers/_php_cast_int.js.map +0 -1
- package/php/_helpers/index.js.map +0 -1
- package/php/array/array_change_key_case.js.map +0 -1
- package/php/array/array_chunk.js.map +0 -1
- package/php/array/array_column.js.map +0 -1
- package/php/array/array_combine.js.map +0 -1
- package/php/array/array_count_values.js.map +0 -1
- package/php/array/array_diff.js.map +0 -1
- package/php/array/array_diff_assoc.js.map +0 -1
- package/php/array/array_diff_key.js.map +0 -1
- package/php/array/array_diff_uassoc.js.map +0 -1
- package/php/array/array_diff_ukey.js.map +0 -1
- package/php/array/array_fill.js.map +0 -1
- package/php/array/array_fill_keys.js.map +0 -1
- package/php/array/array_filter.js.map +0 -1
- package/php/array/array_flip.js.map +0 -1
- package/php/array/array_intersect.js.map +0 -1
- package/php/array/array_intersect_assoc.js.map +0 -1
- package/php/array/array_intersect_key.js.map +0 -1
- package/php/array/array_intersect_uassoc.js.map +0 -1
- package/php/array/array_intersect_ukey.js.map +0 -1
- package/php/array/array_key_exists.js.map +0 -1
- package/php/array/array_keys.js.map +0 -1
- package/php/array/array_map.js.map +0 -1
- package/php/array/array_merge.js.map +0 -1
- package/php/array/array_merge_recursive.js.map +0 -1
- package/php/array/array_multisort.js.map +0 -1
- package/php/array/array_pad.js.map +0 -1
- package/php/array/array_pop.js.map +0 -1
- package/php/array/array_product.js.map +0 -1
- package/php/array/array_push.js.map +0 -1
- package/php/array/array_rand.js.map +0 -1
- package/php/array/array_reduce.js.map +0 -1
- package/php/array/array_replace.js.map +0 -1
- package/php/array/array_replace_recursive.js.map +0 -1
- package/php/array/array_reverse.js.map +0 -1
- package/php/array/array_search.js.map +0 -1
- package/php/array/array_shift.js.map +0 -1
- package/php/array/array_slice.js.map +0 -1
- package/php/array/array_splice.js.map +0 -1
- package/php/array/array_sum.js.map +0 -1
- package/php/array/array_udiff.js.map +0 -1
- package/php/array/array_udiff_assoc.js.map +0 -1
- package/php/array/array_udiff_uassoc.js.map +0 -1
- package/php/array/array_uintersect.js.map +0 -1
- package/php/array/array_uintersect_uassoc.js.map +0 -1
- package/php/array/array_unique.js.map +0 -1
- package/php/array/array_unshift.js.map +0 -1
- package/php/array/array_values.js.map +0 -1
- package/php/array/array_walk.js.map +0 -1
- package/php/array/array_walk_recursive.js.map +0 -1
- package/php/array/arsort.js.map +0 -1
- package/php/array/asort.js.map +0 -1
- package/php/array/count.js.map +0 -1
- package/php/array/current.js.map +0 -1
- package/php/array/each.js.map +0 -1
- package/php/array/end.js.map +0 -1
- package/php/array/in_array.js.map +0 -1
- package/php/array/index.js.map +0 -1
- package/php/array/key.js.map +0 -1
- package/php/array/krsort.js.map +0 -1
- package/php/array/ksort.js.map +0 -1
- package/php/array/natcasesort.js.map +0 -1
- package/php/array/natsort.js.map +0 -1
- package/php/array/next.js.map +0 -1
- package/php/array/pos.js.map +0 -1
- package/php/array/prev.js.map +0 -1
- package/php/array/range.js.map +0 -1
- package/php/array/reset.js.map +0 -1
- package/php/array/rsort.js.map +0 -1
- package/php/array/shuffle.js.map +0 -1
- package/php/array/sizeof.js.map +0 -1
- package/php/array/sort.js.map +0 -1
- package/php/array/uasort.js.map +0 -1
- package/php/array/uksort.js.map +0 -1
- package/php/array/usort.js.map +0 -1
- package/php/bc/bcadd.js.map +0 -1
- package/php/bc/bccomp.js.map +0 -1
- package/php/bc/bcdiv.js.map +0 -1
- package/php/bc/bcmul.js.map +0 -1
- package/php/bc/bcround.js.map +0 -1
- package/php/bc/bcscale.js.map +0 -1
- package/php/bc/bcsub.js.map +0 -1
- package/php/bc/index.js.map +0 -1
- package/php/ctype/ctype_alnum.js.map +0 -1
- package/php/ctype/ctype_alpha.js.map +0 -1
- package/php/ctype/ctype_cntrl.js.map +0 -1
- package/php/ctype/ctype_digit.js.map +0 -1
- package/php/ctype/ctype_graph.js.map +0 -1
- package/php/ctype/ctype_lower.js.map +0 -1
- package/php/ctype/ctype_print.js.map +0 -1
- package/php/ctype/ctype_punct.js.map +0 -1
- package/php/ctype/ctype_space.js.map +0 -1
- package/php/ctype/ctype_upper.js.map +0 -1
- package/php/ctype/ctype_xdigit.js.map +0 -1
- package/php/ctype/index.js.map +0 -1
- package/php/datetime/checkdate.js.map +0 -1
- package/php/datetime/date.js.map +0 -1
- package/php/datetime/date_parse.js.map +0 -1
- package/php/datetime/getdate.js.map +0 -1
- package/php/datetime/gettimeofday.js.map +0 -1
- package/php/datetime/gmdate.js.map +0 -1
- package/php/datetime/gmmktime.js.map +0 -1
- package/php/datetime/gmstrftime.js.map +0 -1
- package/php/datetime/idate.js.map +0 -1
- package/php/datetime/index.js.map +0 -1
- package/php/datetime/microtime.js.map +0 -1
- package/php/datetime/mktime.js.map +0 -1
- package/php/datetime/strftime.js.map +0 -1
- package/php/datetime/strptime.js.map +0 -1
- package/php/datetime/strtotime.js.map +0 -1
- package/php/datetime/time.js.map +0 -1
- package/php/exec/escapeshellarg.js.map +0 -1
- package/php/exec/index.js.map +0 -1
- package/php/filesystem/basename.js.map +0 -1
- package/php/filesystem/dirname.js.map +0 -1
- package/php/filesystem/file_get_contents.js.map +0 -1
- package/php/filesystem/index.js.map +0 -1
- package/php/filesystem/pathinfo.js.map +0 -1
- package/php/filesystem/realpath.js.map +0 -1
- package/php/funchand/call_user_func.js.map +0 -1
- package/php/funchand/call_user_func_array.js.map +0 -1
- package/php/funchand/create_function.js.map +0 -1
- package/php/funchand/function_exists.js.map +0 -1
- package/php/funchand/get_defined_functions.js.map +0 -1
- package/php/funchand/index.js.map +0 -1
- package/php/i18n/i18n_loc_get_default.js.map +0 -1
- package/php/i18n/i18n_loc_set_default.js.map +0 -1
- package/php/i18n/index.js.map +0 -1
- package/php/index.js.map +0 -1
- package/php/info/assert_options.js.map +0 -1
- package/php/info/getenv.js.map +0 -1
- package/php/info/index.js.map +0 -1
- package/php/info/ini_get.js.map +0 -1
- package/php/info/ini_set.js.map +0 -1
- package/php/info/set_time_limit.js.map +0 -1
- package/php/info/version_compare.js.map +0 -1
- package/php/json/index.js.map +0 -1
- package/php/json/json_decode.js.map +0 -1
- package/php/json/json_encode.js.map +0 -1
- package/php/json/json_last_error.js.map +0 -1
- package/php/math/abs.js.map +0 -1
- package/php/math/acos.js.map +0 -1
- package/php/math/acosh.js.map +0 -1
- package/php/math/asin.js.map +0 -1
- package/php/math/asinh.js.map +0 -1
- package/php/math/atan.js.map +0 -1
- package/php/math/atan2.js.map +0 -1
- package/php/math/atanh.js.map +0 -1
- package/php/math/base_convert.js.map +0 -1
- package/php/math/bindec.js.map +0 -1
- package/php/math/ceil.js.map +0 -1
- package/php/math/cos.js.map +0 -1
- package/php/math/cosh.js.map +0 -1
- package/php/math/decbin.js.map +0 -1
- package/php/math/dechex.js.map +0 -1
- package/php/math/decoct.js.map +0 -1
- package/php/math/deg2rad.js.map +0 -1
- package/php/math/exp.js.map +0 -1
- package/php/math/expm1.js.map +0 -1
- package/php/math/floor.js.map +0 -1
- package/php/math/fmod.js.map +0 -1
- package/php/math/getrandmax.js.map +0 -1
- package/php/math/hexdec.js.map +0 -1
- package/php/math/hypot.js.map +0 -1
- package/php/math/index.js.map +0 -1
- package/php/math/is_finite.js.map +0 -1
- package/php/math/is_infinite.js.map +0 -1
- package/php/math/is_nan.js.map +0 -1
- package/php/math/lcg_value.js.map +0 -1
- package/php/math/log.js.map +0 -1
- package/php/math/log10.js.map +0 -1
- package/php/math/log1p.js.map +0 -1
- package/php/math/max.js.map +0 -1
- package/php/math/min.js.map +0 -1
- package/php/math/mt_getrandmax.js.map +0 -1
- package/php/math/mt_rand.js.map +0 -1
- package/php/math/octdec.js.map +0 -1
- package/php/math/pi.js.map +0 -1
- package/php/math/pow.js.map +0 -1
- package/php/math/rad2deg.js.map +0 -1
- package/php/math/rand.js.map +0 -1
- package/php/math/round.js.map +0 -1
- package/php/math/sin.js.map +0 -1
- package/php/math/sinh.js.map +0 -1
- package/php/math/sqrt.js.map +0 -1
- package/php/math/tan.js.map +0 -1
- package/php/math/tanh.js.map +0 -1
- package/php/misc/index.js.map +0 -1
- package/php/misc/pack.js.map +0 -1
- package/php/misc/uniqid.js.map +0 -1
- package/php/net-gopher/gopher_parsedir.js.map +0 -1
- package/php/net-gopher/index.js.map +0 -1
- package/php/network/index.js.map +0 -1
- package/php/network/inet_ntop.js.map +0 -1
- package/php/network/inet_pton.js.map +0 -1
- package/php/network/ip2long.js.map +0 -1
- package/php/network/long2ip.js.map +0 -1
- package/php/network/setcookie.js.map +0 -1
- package/php/network/setrawcookie.js.map +0 -1
- package/php/pcre/index.js.map +0 -1
- package/php/pcre/preg_match.js.map +0 -1
- package/php/pcre/preg_quote.js.map +0 -1
- package/php/pcre/preg_replace.js.map +0 -1
- package/php/pcre/sql_regcase.js.map +0 -1
- package/php/strings/addcslashes.js.map +0 -1
- package/php/strings/addslashes.js.map +0 -1
- package/php/strings/bin2hex.js.map +0 -1
- package/php/strings/chop.js.map +0 -1
- package/php/strings/chr.js.map +0 -1
- package/php/strings/chunk_split.js.map +0 -1
- package/php/strings/convert_cyr_string.js.map +0 -1
- package/php/strings/convert_uuencode.js.map +0 -1
- package/php/strings/count_chars.js.map +0 -1
- package/php/strings/crc32.js.map +0 -1
- package/php/strings/echo.js.map +0 -1
- package/php/strings/explode.js.map +0 -1
- package/php/strings/get_html_translation_table.js.map +0 -1
- package/php/strings/hex2bin.js.map +0 -1
- package/php/strings/html_entity_decode.js.map +0 -1
- package/php/strings/htmlentities.js.map +0 -1
- package/php/strings/htmlspecialchars.js.map +0 -1
- package/php/strings/htmlspecialchars_decode.js.map +0 -1
- package/php/strings/implode.js.map +0 -1
- package/php/strings/index.js.map +0 -1
- package/php/strings/join.js.map +0 -1
- package/php/strings/lcfirst.js.map +0 -1
- package/php/strings/levenshtein.js.map +0 -1
- package/php/strings/localeconv.js.map +0 -1
- package/php/strings/ltrim.js.map +0 -1
- package/php/strings/md5.js.map +0 -1
- package/php/strings/md5_file.js.map +0 -1
- package/php/strings/metaphone.js.map +0 -1
- package/php/strings/money_format.js.map +0 -1
- package/php/strings/nl2br.js.map +0 -1
- package/php/strings/nl_langinfo.js.map +0 -1
- package/php/strings/number_format.js.map +0 -1
- package/php/strings/ord.js.map +0 -1
- package/php/strings/parse_str.js.map +0 -1
- package/php/strings/printf.js.map +0 -1
- package/php/strings/quoted_printable_decode.js.map +0 -1
- package/php/strings/quoted_printable_encode.js.map +0 -1
- package/php/strings/quotemeta.js.map +0 -1
- package/php/strings/rtrim.js.map +0 -1
- package/php/strings/setlocale.js.map +0 -1
- package/php/strings/sha1.js.map +0 -1
- package/php/strings/sha1_file.js.map +0 -1
- package/php/strings/similar_text.js.map +0 -1
- package/php/strings/soundex.js.map +0 -1
- package/php/strings/split.js.map +0 -1
- package/php/strings/sprintf.js.map +0 -1
- package/php/strings/sscanf.js.map +0 -1
- package/php/strings/str_getcsv.js.map +0 -1
- package/php/strings/str_ireplace.js.map +0 -1
- package/php/strings/str_pad.js.map +0 -1
- package/php/strings/str_repeat.js.map +0 -1
- package/php/strings/str_replace.js.map +0 -1
- package/php/strings/str_rot13.js.map +0 -1
- package/php/strings/str_shuffle.js.map +0 -1
- package/php/strings/str_split.js.map +0 -1
- package/php/strings/str_word_count.js.map +0 -1
- package/php/strings/strcasecmp.js.map +0 -1
- package/php/strings/strchr.js.map +0 -1
- package/php/strings/strcmp.js.map +0 -1
- package/php/strings/strcoll.js.map +0 -1
- package/php/strings/strcspn.js.map +0 -1
- package/php/strings/strip_tags.js.map +0 -1
- package/php/strings/stripos.js.map +0 -1
- package/php/strings/stripslashes.js.map +0 -1
- package/php/strings/stristr.js.map +0 -1
- package/php/strings/strlen.js.map +0 -1
- package/php/strings/strnatcasecmp.js.map +0 -1
- package/php/strings/strnatcmp.js.map +0 -1
- package/php/strings/strncasecmp.js.map +0 -1
- package/php/strings/strncmp.js.map +0 -1
- package/php/strings/strpbrk.js.map +0 -1
- package/php/strings/strpos.js.map +0 -1
- package/php/strings/strrchr.js.map +0 -1
- package/php/strings/strrev.js.map +0 -1
- package/php/strings/strripos.js.map +0 -1
- package/php/strings/strrpos.js.map +0 -1
- package/php/strings/strspn.js.map +0 -1
- package/php/strings/strstr.js.map +0 -1
- package/php/strings/strtok.js.map +0 -1
- package/php/strings/strtolower.js.map +0 -1
- package/php/strings/strtoupper.js.map +0 -1
- package/php/strings/strtr.js.map +0 -1
- package/php/strings/substr.js.map +0 -1
- package/php/strings/substr_compare.js.map +0 -1
- package/php/strings/substr_count.js.map +0 -1
- package/php/strings/substr_replace.js.map +0 -1
- package/php/strings/trim.js.map +0 -1
- package/php/strings/ucfirst.js.map +0 -1
- package/php/strings/ucwords.js.map +0 -1
- package/php/strings/vprintf.js.map +0 -1
- package/php/strings/vsprintf.js.map +0 -1
- package/php/strings/wordwrap.js.map +0 -1
- package/php/url/base64_decode.js.map +0 -1
- package/php/url/base64_encode.js.map +0 -1
- package/php/url/http_build_query.js.map +0 -1
- package/php/url/index.js.map +0 -1
- package/php/url/parse_url.js.map +0 -1
- package/php/url/rawurldecode.js.map +0 -1
- package/php/url/rawurlencode.js.map +0 -1
- package/php/url/urldecode.js.map +0 -1
- package/php/url/urlencode.js.map +0 -1
- package/php/var/boolval.js.map +0 -1
- package/php/var/doubleval.js.map +0 -1
- package/php/var/empty.js.map +0 -1
- package/php/var/floatval.js.map +0 -1
- package/php/var/gettype.js.map +0 -1
- package/php/var/index.js.map +0 -1
- package/php/var/intval.js.map +0 -1
- package/php/var/is_array.js.map +0 -1
- package/php/var/is_binary.js.map +0 -1
- package/php/var/is_bool.js.map +0 -1
- package/php/var/is_buffer.js.map +0 -1
- package/php/var/is_callable.js.map +0 -1
- package/php/var/is_double.js.map +0 -1
- package/php/var/is_float.js.map +0 -1
- package/php/var/is_int.js.map +0 -1
- package/php/var/is_integer.js.map +0 -1
- package/php/var/is_long.js.map +0 -1
- package/php/var/is_null.js.map +0 -1
- package/php/var/is_numeric.js.map +0 -1
- package/php/var/is_object.js.map +0 -1
- package/php/var/is_real.js.map +0 -1
- package/php/var/is_scalar.js.map +0 -1
- package/php/var/is_string.js.map +0 -1
- package/php/var/is_unicode.js.map +0 -1
- package/php/var/isset.js.map +0 -1
- package/php/var/print_r.js.map +0 -1
- package/php/var/serialize.js.map +0 -1
- package/php/var/serialize.mocha.js +0 -14
- package/php/var/serialize.mocha.js.map +0 -1
- package/php/var/strval.js.map +0 -1
- package/php/var/unserialize.js.map +0 -1
- package/php/var/var_dump.js.map +0 -1
- package/php/var/var_export.js.map +0 -1
- package/php/xdiff/index.js.map +0 -1
- package/php/xdiff/xdiff_string_diff.js.map +0 -1
- package/php/xdiff/xdiff_string_patch.js.map +0 -1
- package/php/xml/index.js.map +0 -1
- package/php/xml/utf8_decode.js.map +0 -1
- package/php/xml/utf8_encode.js.map +0 -1
- package/python/index.js.map +0 -1
- package/python/string/ascii_letters.js.map +0 -1
- package/python/string/ascii_lowercase.js.map +0 -1
- package/python/string/ascii_uppercase.js.map +0 -1
- package/python/string/capwords.js.map +0 -1
- package/python/string/index.js.map +0 -1
- package/python/string/punctuation.js.map +0 -1
- package/ruby/Math/acos.js.map +0 -1
- package/ruby/Math/index.js.map +0 -1
- package/ruby/index.js.map +0 -1
|
@@ -1,437 +1,451 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
4
|
-
|
|
5
1
|
module.exports = function xdiff_string_diff(oldData, newData, contextLines, minimal) {
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
2
|
+
// discuss at: https://locutus.io/php/xdiff_string_diff
|
|
3
|
+
// parity verified: PHP 8.3
|
|
4
|
+
// original by: Brett Zamir (https://brett-zamir.me)
|
|
5
|
+
// based on: Imgen Tata (https://www.myipdf.com/)
|
|
6
|
+
// bugfixed by: Imgen Tata (https://www.myipdf.com/)
|
|
7
|
+
// improved by: Brett Zamir (https://brett-zamir.me)
|
|
8
|
+
// note 1: The minimal argument is not currently supported
|
|
9
|
+
// example 1: xdiff_string_diff('', 'Hello world!')
|
|
10
|
+
// returns 1: '@@ -0,0 +1,1 @@\n+Hello world!'
|
|
14
11
|
|
|
15
12
|
// (This code was done by Imgen Tata; I have only reformatted for use in Locutus)
|
|
16
13
|
|
|
17
14
|
// See https://en.wikipedia.org/wiki/Diff#Unified_format
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
15
|
+
let i = 0
|
|
16
|
+
let j = 0
|
|
17
|
+
let k = 0
|
|
18
|
+
let oriHunkStart
|
|
19
|
+
let newHunkStart
|
|
20
|
+
let oriHunkEnd
|
|
21
|
+
let newHunkEnd
|
|
22
|
+
let oriHunkLineNo
|
|
23
|
+
let newHunkLineNo
|
|
24
|
+
let oriHunkSize
|
|
25
|
+
let newHunkSize
|
|
26
|
+
const MAX_CONTEXT_LINES = Number.POSITIVE_INFINITY // Potential configuration
|
|
27
|
+
const MIN_CONTEXT_LINES = 0
|
|
28
|
+
const DEFAULT_CONTEXT_LINES = 3
|
|
29
|
+
const HEADER_PREFIX = '@@ ' //
|
|
30
|
+
const HEADER_SUFFIX = ' @@'
|
|
31
|
+
const ORIGINAL_INDICATOR = '-'
|
|
32
|
+
const NEW_INDICATOR = '+'
|
|
33
|
+
const RANGE_SEPARATOR = ','
|
|
34
|
+
const CONTEXT_INDICATOR = ' '
|
|
35
|
+
const DELETION_INDICATOR = '-'
|
|
36
|
+
const ADDITION_INDICATOR = '+'
|
|
37
|
+
let oriLines
|
|
38
|
+
let newLines
|
|
39
|
+
const NEW_LINE = '\n'
|
|
40
|
+
|
|
41
|
+
const _trim = function (text) {
|
|
45
42
|
if (typeof text !== 'string') {
|
|
46
|
-
throw new Error('String parameter required')
|
|
43
|
+
throw new Error('String parameter required')
|
|
47
44
|
}
|
|
48
45
|
|
|
49
|
-
return text.replace(/(^\s*)|(\s*$)/g, '')
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
return text.replace(/(^\s*)|(\s*$)/g, '')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const _verifyType = function (type) {
|
|
50
|
+
const args = arguments
|
|
51
|
+
const argsLen = arguments.length
|
|
52
|
+
const basicTypes = ['number', 'boolean', 'string', 'function', 'object', 'undefined']
|
|
53
|
+
let basicType
|
|
54
|
+
let i
|
|
55
|
+
let j
|
|
56
|
+
const typeOfType = typeof type
|
|
60
57
|
if (typeOfType !== 'string' && typeOfType !== 'function') {
|
|
61
|
-
throw new Error('Bad type parameter')
|
|
58
|
+
throw new Error('Bad type parameter')
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
if (argsLen < 2) {
|
|
65
|
-
throw new Error('Too few arguments')
|
|
62
|
+
throw new Error('Too few arguments')
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
if (typeOfType === 'string') {
|
|
69
|
-
type = _trim(type)
|
|
66
|
+
type = _trim(type)
|
|
70
67
|
|
|
71
68
|
if (type === '') {
|
|
72
|
-
throw new Error('Bad type parameter')
|
|
69
|
+
throw new Error('Bad type parameter')
|
|
73
70
|
}
|
|
74
71
|
|
|
75
72
|
for (j = 0; j < basicTypes.length; j++) {
|
|
76
|
-
basicType = basicTypes[j]
|
|
73
|
+
basicType = basicTypes[j]
|
|
77
74
|
|
|
78
75
|
if (basicType === type) {
|
|
79
76
|
for (i = 1; i < argsLen; i++) {
|
|
80
|
-
if (
|
|
81
|
-
throw new Error('Bad type')
|
|
77
|
+
if (typeof args[i] !== type) {
|
|
78
|
+
throw new Error('Bad type')
|
|
82
79
|
}
|
|
83
80
|
}
|
|
84
81
|
|
|
85
|
-
return
|
|
82
|
+
return
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
85
|
|
|
89
|
-
throw new Error('Bad type parameter')
|
|
86
|
+
throw new Error('Bad type parameter')
|
|
90
87
|
}
|
|
91
88
|
|
|
92
89
|
// Not basic type. we need to use instanceof operator
|
|
93
90
|
for (i = 1; i < argsLen; i++) {
|
|
94
91
|
if (!(args[i] instanceof type)) {
|
|
95
|
-
throw new Error('Bad type')
|
|
92
|
+
throw new Error('Bad type')
|
|
96
93
|
}
|
|
97
94
|
}
|
|
98
|
-
}
|
|
95
|
+
}
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
_verifyType(Array, array)
|
|
97
|
+
const _hasValue = function (array, value) {
|
|
98
|
+
let i
|
|
99
|
+
_verifyType(Array, array)
|
|
103
100
|
|
|
104
101
|
for (i = 0; i < array.length; i++) {
|
|
105
102
|
if (array[i] === value) {
|
|
106
|
-
return true
|
|
103
|
+
return true
|
|
107
104
|
}
|
|
108
105
|
}
|
|
109
106
|
|
|
110
|
-
return false
|
|
111
|
-
}
|
|
107
|
+
return false
|
|
108
|
+
}
|
|
112
109
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
110
|
+
const _areTypeOf = function (type) {
|
|
111
|
+
const args = arguments
|
|
112
|
+
const argsLen = arguments.length
|
|
113
|
+
const basicTypes = ['number', 'boolean', 'string', 'function', 'object', 'undefined']
|
|
114
|
+
let basicType
|
|
115
|
+
let i
|
|
116
|
+
let j
|
|
117
|
+
const typeOfType = typeof type
|
|
121
118
|
|
|
122
119
|
if (typeOfType !== 'string' && typeOfType !== 'function') {
|
|
123
|
-
throw new Error('Bad type parameter')
|
|
120
|
+
throw new Error('Bad type parameter')
|
|
124
121
|
}
|
|
125
122
|
|
|
126
123
|
if (argsLen < 2) {
|
|
127
|
-
throw new Error('Too few arguments')
|
|
124
|
+
throw new Error('Too few arguments')
|
|
128
125
|
}
|
|
129
126
|
|
|
130
127
|
if (typeOfType === 'string') {
|
|
131
|
-
type = _trim(type)
|
|
128
|
+
type = _trim(type)
|
|
132
129
|
|
|
133
130
|
if (type === '') {
|
|
134
|
-
return false
|
|
131
|
+
return false
|
|
135
132
|
}
|
|
136
133
|
|
|
137
134
|
for (j = 0; j < basicTypes.length; j++) {
|
|
138
|
-
basicType = basicTypes[j]
|
|
135
|
+
basicType = basicTypes[j]
|
|
139
136
|
|
|
140
137
|
if (basicType === type) {
|
|
141
138
|
for (i = 1; i < argsLen; i++) {
|
|
142
|
-
if (
|
|
143
|
-
return false
|
|
139
|
+
if (typeof args[i] !== type) {
|
|
140
|
+
return false
|
|
144
141
|
}
|
|
145
142
|
}
|
|
146
143
|
|
|
147
|
-
return true
|
|
144
|
+
return true
|
|
148
145
|
}
|
|
149
146
|
}
|
|
150
147
|
|
|
151
|
-
throw new Error('Bad type parameter')
|
|
148
|
+
throw new Error('Bad type parameter')
|
|
152
149
|
}
|
|
153
150
|
|
|
154
151
|
// Not basic type. we need to use instanceof operator
|
|
155
152
|
for (i = 1; i < argsLen; i++) {
|
|
156
153
|
if (!(args[i] instanceof type)) {
|
|
157
|
-
return false
|
|
154
|
+
return false
|
|
158
155
|
}
|
|
159
156
|
}
|
|
160
157
|
|
|
161
|
-
return true
|
|
162
|
-
}
|
|
158
|
+
return true
|
|
159
|
+
}
|
|
163
160
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
_verifyType('number', arraySize)
|
|
161
|
+
const _getInitializedArray = function (arraySize, initValue) {
|
|
162
|
+
const array = []
|
|
163
|
+
let i
|
|
164
|
+
_verifyType('number', arraySize)
|
|
168
165
|
|
|
169
166
|
for (i = 0; i < arraySize; i++) {
|
|
170
|
-
array.push(initValue)
|
|
167
|
+
array.push(initValue)
|
|
171
168
|
}
|
|
172
169
|
|
|
173
|
-
return array
|
|
174
|
-
}
|
|
170
|
+
return array
|
|
171
|
+
}
|
|
175
172
|
|
|
176
|
-
|
|
177
|
-
_verifyType('string', text)
|
|
173
|
+
const _splitIntoLines = function (text) {
|
|
174
|
+
_verifyType('string', text)
|
|
178
175
|
|
|
179
176
|
if (text === '') {
|
|
180
|
-
return []
|
|
177
|
+
return []
|
|
181
178
|
}
|
|
182
|
-
return text.split('\n')
|
|
183
|
-
}
|
|
179
|
+
return text.split('\n')
|
|
180
|
+
}
|
|
184
181
|
|
|
185
|
-
|
|
186
|
-
return _areTypeOf(Array, obj) && obj.length === 0
|
|
187
|
-
}
|
|
182
|
+
const _isEmptyArray = function (obj) {
|
|
183
|
+
return _areTypeOf(Array, obj) && obj.length === 0
|
|
184
|
+
}
|
|
188
185
|
|
|
189
186
|
/**
|
|
190
187
|
* Finds longest common sequence between two sequences
|
|
191
188
|
* @see {@link https://wordaligned.org/articles/longest-common-subsequence}
|
|
192
189
|
*/
|
|
193
|
-
|
|
190
|
+
const _findLongestCommonSequence = function (seq1, seq2, seq1IsInLcs, seq2IsInLcs) {
|
|
194
191
|
if (!_areTypeOf(Array, seq1, seq2)) {
|
|
195
|
-
throw new Error('Array parameters are required')
|
|
192
|
+
throw new Error('Array parameters are required')
|
|
196
193
|
}
|
|
197
194
|
|
|
198
195
|
// Deal with edge case
|
|
199
196
|
if (_isEmptyArray(seq1) || _isEmptyArray(seq2)) {
|
|
200
|
-
return []
|
|
197
|
+
return []
|
|
201
198
|
}
|
|
202
199
|
|
|
203
200
|
// Function to calculate lcs lengths
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
201
|
+
const lcsLens = function (xs, ys) {
|
|
202
|
+
let i
|
|
203
|
+
let j
|
|
204
|
+
let prev
|
|
205
|
+
const curr = _getInitializedArray(ys.length + 1, 0)
|
|
209
206
|
|
|
210
207
|
for (i = 0; i < xs.length; i++) {
|
|
211
|
-
prev = curr.slice(0)
|
|
208
|
+
prev = curr.slice(0)
|
|
212
209
|
for (j = 0; j < ys.length; j++) {
|
|
213
210
|
if (xs[i] === ys[j]) {
|
|
214
|
-
curr[j + 1] = prev[j] + 1
|
|
211
|
+
curr[j + 1] = prev[j] + 1
|
|
215
212
|
} else {
|
|
216
|
-
curr[j + 1] = Math.max(curr[j], prev[j + 1])
|
|
213
|
+
curr[j + 1] = Math.max(curr[j], prev[j + 1])
|
|
217
214
|
}
|
|
218
215
|
}
|
|
219
216
|
}
|
|
220
217
|
|
|
221
|
-
return curr
|
|
222
|
-
}
|
|
218
|
+
return curr
|
|
219
|
+
}
|
|
223
220
|
|
|
224
221
|
// Function to find lcs and fill in the array to indicate the optimal longest common sequence
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
var xe = void 0;
|
|
229
|
-
var llB = void 0;
|
|
230
|
-
var llE = void 0;
|
|
231
|
-
var pivot = void 0;
|
|
232
|
-
var max = void 0;
|
|
233
|
-
var yb = void 0;
|
|
234
|
-
var ye = void 0;
|
|
235
|
-
var nx = xs.length;
|
|
236
|
-
var ny = ys.length;
|
|
222
|
+
const _findLcs = function (xs, xidx, xIsIn, ys) {
|
|
223
|
+
const nx = xs.length
|
|
224
|
+
const ny = ys.length
|
|
237
225
|
|
|
238
226
|
if (nx === 0) {
|
|
239
|
-
return []
|
|
227
|
+
return []
|
|
240
228
|
}
|
|
241
229
|
if (nx === 1) {
|
|
242
230
|
if (_hasValue(ys, xs[0])) {
|
|
243
|
-
xIsIn[xidx] = true
|
|
244
|
-
return [xs[0]]
|
|
231
|
+
xIsIn[xidx] = true
|
|
232
|
+
return [xs[0]]
|
|
245
233
|
}
|
|
246
|
-
return []
|
|
234
|
+
return []
|
|
247
235
|
}
|
|
248
|
-
i = Math.floor(nx / 2)
|
|
249
|
-
xb = xs.slice(0, i)
|
|
250
|
-
xe = xs.slice(i)
|
|
251
|
-
llB = lcsLens(xb, ys)
|
|
252
|
-
llE = lcsLens(xe.slice(0).reverse(), ys.slice(0).reverse())
|
|
253
|
-
|
|
254
|
-
pivot = 0
|
|
255
|
-
max = 0
|
|
236
|
+
const i = Math.floor(nx / 2)
|
|
237
|
+
const xb = xs.slice(0, i)
|
|
238
|
+
const xe = xs.slice(i)
|
|
239
|
+
const llB = lcsLens(xb, ys)
|
|
240
|
+
const llE = lcsLens(xe.slice(0).reverse(), ys.slice(0).reverse())
|
|
241
|
+
|
|
242
|
+
let pivot = 0
|
|
243
|
+
let max = 0
|
|
256
244
|
for (j = 0; j <= ny; j++) {
|
|
257
245
|
if (llB[j] + llE[ny - j] > max) {
|
|
258
|
-
pivot = j
|
|
259
|
-
max = llB[j] + llE[ny - j]
|
|
246
|
+
pivot = j
|
|
247
|
+
max = llB[j] + llE[ny - j]
|
|
260
248
|
}
|
|
261
249
|
}
|
|
262
|
-
yb = ys.slice(0, pivot)
|
|
263
|
-
ye = ys.slice(pivot)
|
|
264
|
-
return _findLcs(xb, xidx, xIsIn, yb).concat(_findLcs(xe, xidx + i, xIsIn, ye))
|
|
265
|
-
}
|
|
250
|
+
const yb = ys.slice(0, pivot)
|
|
251
|
+
const ye = ys.slice(pivot)
|
|
252
|
+
return _findLcs(xb, xidx, xIsIn, yb).concat(_findLcs(xe, xidx + i, xIsIn, ye))
|
|
253
|
+
}
|
|
266
254
|
|
|
267
255
|
// Fill in seq1IsInLcs to find the optimal longest common subsequence of first sequence
|
|
268
|
-
_findLcs(seq1, 0, seq1IsInLcs, seq2)
|
|
256
|
+
_findLcs(seq1, 0, seq1IsInLcs, seq2)
|
|
269
257
|
// Fill in seq2IsInLcs to find the optimal longest common subsequence
|
|
270
258
|
// of second sequence and return the result
|
|
271
|
-
return _findLcs(seq2, 0, seq2IsInLcs, seq1)
|
|
272
|
-
}
|
|
259
|
+
return _findLcs(seq2, 0, seq2IsInLcs, seq1)
|
|
260
|
+
}
|
|
273
261
|
|
|
274
262
|
// First, check the parameters
|
|
275
263
|
if (_areTypeOf('string', oldData, newData) === false) {
|
|
276
|
-
return false
|
|
264
|
+
return false
|
|
277
265
|
}
|
|
278
266
|
|
|
279
267
|
if (oldData === newData) {
|
|
280
|
-
return ''
|
|
268
|
+
return ''
|
|
281
269
|
}
|
|
282
270
|
|
|
283
271
|
if (typeof contextLines !== 'number' || contextLines > MAX_CONTEXT_LINES || contextLines < MIN_CONTEXT_LINES) {
|
|
284
|
-
contextLines = DEFAULT_CONTEXT_LINES
|
|
272
|
+
contextLines = DEFAULT_CONTEXT_LINES
|
|
285
273
|
}
|
|
286
274
|
|
|
287
|
-
oriLines = _splitIntoLines(oldData)
|
|
288
|
-
newLines = _splitIntoLines(newData)
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
275
|
+
oriLines = _splitIntoLines(oldData)
|
|
276
|
+
newLines = _splitIntoLines(newData)
|
|
277
|
+
const oriLen = oriLines.length
|
|
278
|
+
const newLen = newLines.length
|
|
279
|
+
const oriIsInLcs = _getInitializedArray(oriLen, false)
|
|
280
|
+
const newIsInLcs = _getInitializedArray(newLen, false)
|
|
281
|
+
const lcsLen = _findLongestCommonSequence(oriLines, newLines, oriIsInLcs, newIsInLcs).length
|
|
282
|
+
let unidiff = ''
|
|
295
283
|
|
|
296
284
|
if (lcsLen === 0) {
|
|
297
285
|
// No common sequence
|
|
298
|
-
unidiff = [
|
|
286
|
+
unidiff = [
|
|
287
|
+
HEADER_PREFIX,
|
|
288
|
+
ORIGINAL_INDICATOR,
|
|
289
|
+
oriLen > 0 ? '1' : '0',
|
|
290
|
+
RANGE_SEPARATOR,
|
|
291
|
+
oriLen,
|
|
292
|
+
' ',
|
|
293
|
+
NEW_INDICATOR,
|
|
294
|
+
newLen > 0 ? '1' : '0',
|
|
295
|
+
RANGE_SEPARATOR,
|
|
296
|
+
newLen,
|
|
297
|
+
HEADER_SUFFIX,
|
|
298
|
+
].join('')
|
|
299
299
|
|
|
300
300
|
for (i = 0; i < oriLen; i++) {
|
|
301
|
-
unidiff += NEW_LINE + DELETION_INDICATOR + oriLines[i]
|
|
301
|
+
unidiff += NEW_LINE + DELETION_INDICATOR + oriLines[i]
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
for (j = 0; j < newLen; j++) {
|
|
305
|
-
unidiff += NEW_LINE + ADDITION_INDICATOR + newLines[j]
|
|
305
|
+
unidiff += NEW_LINE + ADDITION_INDICATOR + newLines[j]
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
return unidiff
|
|
308
|
+
return unidiff
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
311
|
+
let leadingContext = []
|
|
312
|
+
let trailingContext = []
|
|
313
|
+
let actualLeadingContext = []
|
|
314
|
+
let actualTrailingContext = []
|
|
315
315
|
|
|
316
316
|
// Regularize leading context by the contextLines parameter
|
|
317
|
-
|
|
317
|
+
const regularizeLeadingContext = function (context) {
|
|
318
318
|
if (context.length === 0 || contextLines === 0) {
|
|
319
|
-
return []
|
|
319
|
+
return []
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
const contextStartPos = Math.max(context.length - contextLines, 0)
|
|
323
323
|
|
|
324
|
-
return context.slice(contextStartPos)
|
|
325
|
-
}
|
|
324
|
+
return context.slice(contextStartPos)
|
|
325
|
+
}
|
|
326
326
|
|
|
327
327
|
// Regularize trailing context by the contextLines parameter
|
|
328
|
-
|
|
328
|
+
const regularizeTrailingContext = function (context) {
|
|
329
329
|
if (context.length === 0 || contextLines === 0) {
|
|
330
|
-
return []
|
|
330
|
+
return []
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
-
return context.slice(0, Math.min(contextLines, context.length))
|
|
334
|
-
}
|
|
333
|
+
return context.slice(0, Math.min(contextLines, context.length))
|
|
334
|
+
}
|
|
335
335
|
|
|
336
336
|
// Skip common lines in the beginning
|
|
337
337
|
while (i < oriLen && oriIsInLcs[i] === true && newIsInLcs[i] === true) {
|
|
338
|
-
leadingContext.push(oriLines[i])
|
|
339
|
-
i
|
|
338
|
+
leadingContext.push(oriLines[i])
|
|
339
|
+
i++
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
j = i
|
|
342
|
+
j = i
|
|
343
343
|
// The index in the longest common sequence
|
|
344
|
-
k = i
|
|
345
|
-
oriHunkStart = i
|
|
346
|
-
newHunkStart = j
|
|
347
|
-
oriHunkEnd = i
|
|
348
|
-
newHunkEnd = j
|
|
344
|
+
k = i
|
|
345
|
+
oriHunkStart = i
|
|
346
|
+
newHunkStart = j
|
|
347
|
+
oriHunkEnd = i
|
|
348
|
+
newHunkEnd = j
|
|
349
349
|
|
|
350
350
|
while (i < oriLen || j < newLen) {
|
|
351
351
|
while (i < oriLen && oriIsInLcs[i] === false) {
|
|
352
|
-
i
|
|
352
|
+
i++
|
|
353
353
|
}
|
|
354
|
-
oriHunkEnd = i
|
|
354
|
+
oriHunkEnd = i
|
|
355
355
|
|
|
356
356
|
while (j < newLen && newIsInLcs[j] === false) {
|
|
357
|
-
j
|
|
357
|
+
j++
|
|
358
358
|
}
|
|
359
|
-
newHunkEnd = j
|
|
359
|
+
newHunkEnd = j
|
|
360
360
|
|
|
361
361
|
// Find the trailing context
|
|
362
|
-
trailingContext = []
|
|
362
|
+
trailingContext = []
|
|
363
363
|
while (i < oriLen && oriIsInLcs[i] === true && j < newLen && newIsInLcs[j] === true) {
|
|
364
|
-
trailingContext.push(oriLines[i])
|
|
365
|
-
k
|
|
366
|
-
i
|
|
367
|
-
j
|
|
364
|
+
trailingContext.push(oriLines[i])
|
|
365
|
+
k++
|
|
366
|
+
i++
|
|
367
|
+
j++
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
if (
|
|
371
|
-
|
|
370
|
+
if (
|
|
371
|
+
k >= lcsLen || // No more in longest common lines
|
|
372
|
+
trailingContext.length >= 2 * contextLines
|
|
373
|
+
) {
|
|
372
374
|
// Context break found
|
|
373
375
|
if (trailingContext.length < 2 * contextLines) {
|
|
374
376
|
// It must be last block of common lines but not a context break
|
|
375
|
-
trailingContext = []
|
|
377
|
+
trailingContext = []
|
|
376
378
|
|
|
377
379
|
// Force break out
|
|
378
|
-
i = oriLen
|
|
379
|
-
j = newLen
|
|
380
|
+
i = oriLen
|
|
381
|
+
j = newLen
|
|
380
382
|
|
|
381
383
|
// Update hunk ends to force output to the end
|
|
382
|
-
oriHunkEnd = oriLen
|
|
383
|
-
newHunkEnd = newLen
|
|
384
|
+
oriHunkEnd = oriLen
|
|
385
|
+
newHunkEnd = newLen
|
|
384
386
|
}
|
|
385
387
|
|
|
386
388
|
// Output the diff hunk
|
|
387
389
|
|
|
388
390
|
// Trim the leading and trailing context block
|
|
389
|
-
actualLeadingContext = regularizeLeadingContext(leadingContext)
|
|
390
|
-
actualTrailingContext = regularizeTrailingContext(trailingContext)
|
|
391
|
+
actualLeadingContext = regularizeLeadingContext(leadingContext)
|
|
392
|
+
actualTrailingContext = regularizeTrailingContext(trailingContext)
|
|
391
393
|
|
|
392
|
-
oriHunkStart -= actualLeadingContext.length
|
|
393
|
-
newHunkStart -= actualLeadingContext.length
|
|
394
|
-
oriHunkEnd += actualTrailingContext.length
|
|
395
|
-
newHunkEnd += actualTrailingContext.length
|
|
394
|
+
oriHunkStart -= actualLeadingContext.length
|
|
395
|
+
newHunkStart -= actualLeadingContext.length
|
|
396
|
+
oriHunkEnd += actualTrailingContext.length
|
|
397
|
+
newHunkEnd += actualTrailingContext.length
|
|
396
398
|
|
|
397
|
-
oriHunkLineNo = oriHunkStart + 1
|
|
398
|
-
newHunkLineNo = newHunkStart + 1
|
|
399
|
-
oriHunkSize = oriHunkEnd - oriHunkStart
|
|
400
|
-
newHunkSize = newHunkEnd - newHunkStart
|
|
399
|
+
oriHunkLineNo = oriHunkStart + 1
|
|
400
|
+
newHunkLineNo = newHunkStart + 1
|
|
401
|
+
oriHunkSize = oriHunkEnd - oriHunkStart
|
|
402
|
+
newHunkSize = newHunkEnd - newHunkStart
|
|
401
403
|
|
|
402
404
|
// Build header
|
|
403
|
-
unidiff += [
|
|
405
|
+
unidiff += [
|
|
406
|
+
HEADER_PREFIX,
|
|
407
|
+
ORIGINAL_INDICATOR,
|
|
408
|
+
oriHunkLineNo,
|
|
409
|
+
RANGE_SEPARATOR,
|
|
410
|
+
oriHunkSize,
|
|
411
|
+
' ',
|
|
412
|
+
NEW_INDICATOR,
|
|
413
|
+
newHunkLineNo,
|
|
414
|
+
RANGE_SEPARATOR,
|
|
415
|
+
newHunkSize,
|
|
416
|
+
HEADER_SUFFIX,
|
|
417
|
+
NEW_LINE,
|
|
418
|
+
].join('')
|
|
404
419
|
|
|
405
420
|
// Build the diff hunk content
|
|
406
421
|
while (oriHunkStart < oriHunkEnd || newHunkStart < newHunkEnd) {
|
|
407
422
|
if (oriHunkStart < oriHunkEnd && oriIsInLcs[oriHunkStart] === true && newIsInLcs[newHunkStart] === true) {
|
|
408
423
|
// The context line
|
|
409
|
-
unidiff += CONTEXT_INDICATOR + oriLines[oriHunkStart] + NEW_LINE
|
|
410
|
-
oriHunkStart
|
|
411
|
-
newHunkStart
|
|
424
|
+
unidiff += CONTEXT_INDICATOR + oriLines[oriHunkStart] + NEW_LINE
|
|
425
|
+
oriHunkStart++
|
|
426
|
+
newHunkStart++
|
|
412
427
|
} else if (oriHunkStart < oriHunkEnd && oriIsInLcs[oriHunkStart] === false) {
|
|
413
428
|
// The deletion line
|
|
414
|
-
unidiff += DELETION_INDICATOR + oriLines[oriHunkStart] + NEW_LINE
|
|
415
|
-
oriHunkStart
|
|
429
|
+
unidiff += DELETION_INDICATOR + oriLines[oriHunkStart] + NEW_LINE
|
|
430
|
+
oriHunkStart++
|
|
416
431
|
} else if (newHunkStart < newHunkEnd && newIsInLcs[newHunkStart] === false) {
|
|
417
432
|
// The additional line
|
|
418
|
-
unidiff += ADDITION_INDICATOR + newLines[newHunkStart] + NEW_LINE
|
|
419
|
-
newHunkStart
|
|
433
|
+
unidiff += ADDITION_INDICATOR + newLines[newHunkStart] + NEW_LINE
|
|
434
|
+
newHunkStart++
|
|
420
435
|
}
|
|
421
436
|
}
|
|
422
437
|
|
|
423
438
|
// Update hunk position and leading context
|
|
424
|
-
oriHunkStart = i
|
|
425
|
-
newHunkStart = j
|
|
426
|
-
leadingContext = trailingContext
|
|
439
|
+
oriHunkStart = i
|
|
440
|
+
newHunkStart = j
|
|
441
|
+
leadingContext = trailingContext
|
|
427
442
|
}
|
|
428
443
|
}
|
|
429
444
|
|
|
430
445
|
// Trim the trailing new line if it exists
|
|
431
446
|
if (unidiff.length > 0 && unidiff.charAt(unidiff.length) === NEW_LINE) {
|
|
432
|
-
unidiff = unidiff.slice(0, -1)
|
|
447
|
+
unidiff = unidiff.slice(0, -1)
|
|
433
448
|
}
|
|
434
449
|
|
|
435
|
-
return unidiff
|
|
436
|
-
}
|
|
437
|
-
//# sourceMappingURL=xdiff_string_diff.js.map
|
|
450
|
+
return unidiff
|
|
451
|
+
}
|