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
package/php/var/unserialize.js
CHANGED
|
@@ -1,300 +1,272 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
4
|
-
|
|
5
1
|
function initCache() {
|
|
6
|
-
|
|
2
|
+
const store = []
|
|
7
3
|
// cache only first element, second is length to jump ahead for the parser
|
|
8
|
-
|
|
9
|
-
store.push(value[0])
|
|
10
|
-
return value
|
|
11
|
-
}
|
|
4
|
+
const cache = function cache(value) {
|
|
5
|
+
store.push(value[0])
|
|
6
|
+
return value
|
|
7
|
+
}
|
|
12
8
|
|
|
13
|
-
cache.get =
|
|
9
|
+
cache.get = (index) => {
|
|
14
10
|
if (index >= store.length) {
|
|
15
|
-
throw RangeError(
|
|
11
|
+
throw new RangeError(`Can't resolve reference ${index + 1}`)
|
|
16
12
|
}
|
|
17
13
|
|
|
18
|
-
return store[index]
|
|
19
|
-
}
|
|
14
|
+
return store[index]
|
|
15
|
+
}
|
|
20
16
|
|
|
21
|
-
return cache
|
|
17
|
+
return cache
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
function expectType(str, cache) {
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
const types = /^(?:N(?=;)|[bidsSaOCrR](?=:)|[^:]+(?=:))/g
|
|
22
|
+
const type = (types.exec(str) || [])[0]
|
|
27
23
|
|
|
28
24
|
if (!type) {
|
|
29
|
-
throw SyntaxError('Invalid input: ' + str)
|
|
25
|
+
throw new SyntaxError('Invalid input: ' + str)
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
switch (type) {
|
|
33
29
|
case 'N':
|
|
34
|
-
return cache([null, 2])
|
|
30
|
+
return cache([null, 2])
|
|
35
31
|
case 'b':
|
|
36
|
-
return cache(expectBool(str))
|
|
32
|
+
return cache(expectBool(str))
|
|
37
33
|
case 'i':
|
|
38
|
-
return cache(expectInt(str))
|
|
34
|
+
return cache(expectInt(str))
|
|
39
35
|
case 'd':
|
|
40
|
-
return cache(expectFloat(str))
|
|
36
|
+
return cache(expectFloat(str))
|
|
41
37
|
case 's':
|
|
42
|
-
return cache(expectString(str))
|
|
38
|
+
return cache(expectString(str))
|
|
43
39
|
case 'S':
|
|
44
|
-
return cache(expectEscapedString(str))
|
|
40
|
+
return cache(expectEscapedString(str))
|
|
45
41
|
case 'a':
|
|
46
|
-
return expectArray(str, cache)
|
|
42
|
+
return expectArray(str, cache)
|
|
47
43
|
case 'O':
|
|
48
|
-
return expectObject(str, cache)
|
|
44
|
+
return expectObject(str, cache)
|
|
49
45
|
case 'C':
|
|
50
|
-
return expectClass(str, cache)
|
|
46
|
+
return expectClass(str, cache)
|
|
51
47
|
case 'r':
|
|
52
48
|
case 'R':
|
|
53
|
-
return expectReference(str, cache)
|
|
49
|
+
return expectReference(str, cache)
|
|
54
50
|
default:
|
|
55
|
-
throw SyntaxError(
|
|
51
|
+
throw new SyntaxError(`Invalid or unsupported data type: ${type}`)
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
function expectBool(str) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var _ref = reBool.exec(str) || [],
|
|
63
|
-
_ref2 = _slicedToArray(_ref, 2),
|
|
64
|
-
match = _ref2[0],
|
|
65
|
-
boolMatch = _ref2[1];
|
|
56
|
+
const reBool = /^b:([01]);/
|
|
57
|
+
const [match, boolMatch] = reBool.exec(str) || []
|
|
66
58
|
|
|
67
59
|
if (!boolMatch) {
|
|
68
|
-
throw SyntaxError('Invalid bool value, expected 0 or 1')
|
|
60
|
+
throw new SyntaxError('Invalid bool value, expected 0 or 1')
|
|
69
61
|
}
|
|
70
62
|
|
|
71
|
-
return [boolMatch === '1', match.length]
|
|
63
|
+
return [boolMatch === '1', match.length]
|
|
72
64
|
}
|
|
73
65
|
|
|
74
66
|
function expectInt(str) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var _ref3 = reInt.exec(str) || [],
|
|
78
|
-
_ref4 = _slicedToArray(_ref3, 2),
|
|
79
|
-
match = _ref4[0],
|
|
80
|
-
intMatch = _ref4[1];
|
|
67
|
+
const reInt = /^i:([+-]?\d+);/
|
|
68
|
+
const [match, intMatch] = reInt.exec(str) || []
|
|
81
69
|
|
|
82
70
|
if (!intMatch) {
|
|
83
|
-
throw SyntaxError('Expected an integer value')
|
|
71
|
+
throw new SyntaxError('Expected an integer value')
|
|
84
72
|
}
|
|
85
73
|
|
|
86
|
-
return [parseInt(intMatch, 10), match.length]
|
|
74
|
+
return [parseInt(intMatch, 10), match.length]
|
|
87
75
|
}
|
|
88
76
|
|
|
89
77
|
function expectFloat(str) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var _ref5 = reFloat.exec(str) || [],
|
|
93
|
-
_ref6 = _slicedToArray(_ref5, 2),
|
|
94
|
-
match = _ref6[0],
|
|
95
|
-
floatMatch = _ref6[1];
|
|
78
|
+
const reFloat = /^d:(NAN|-?INF|(?:\d+\.\d*|\d*\.\d+|\d+)(?:[eE][+-]\d+)?);/
|
|
79
|
+
const [match, floatMatch] = reFloat.exec(str) || []
|
|
96
80
|
|
|
97
81
|
if (!floatMatch) {
|
|
98
|
-
throw SyntaxError('Expected a float value')
|
|
82
|
+
throw new SyntaxError('Expected a float value')
|
|
99
83
|
}
|
|
100
84
|
|
|
101
|
-
|
|
85
|
+
let floatValue
|
|
102
86
|
|
|
103
87
|
switch (floatMatch) {
|
|
104
88
|
case 'NAN':
|
|
105
|
-
floatValue = Number.NaN
|
|
106
|
-
break
|
|
89
|
+
floatValue = Number.NaN
|
|
90
|
+
break
|
|
107
91
|
case '-INF':
|
|
108
|
-
floatValue = Number.NEGATIVE_INFINITY
|
|
109
|
-
break
|
|
92
|
+
floatValue = Number.NEGATIVE_INFINITY
|
|
93
|
+
break
|
|
110
94
|
case 'INF':
|
|
111
|
-
floatValue = Number.POSITIVE_INFINITY
|
|
112
|
-
break
|
|
95
|
+
floatValue = Number.POSITIVE_INFINITY
|
|
96
|
+
break
|
|
113
97
|
default:
|
|
114
|
-
floatValue = parseFloat(floatMatch)
|
|
115
|
-
break
|
|
98
|
+
floatValue = parseFloat(floatMatch)
|
|
99
|
+
break
|
|
116
100
|
}
|
|
117
101
|
|
|
118
|
-
return [floatValue, match.length]
|
|
102
|
+
return [floatValue, match.length]
|
|
119
103
|
}
|
|
120
104
|
|
|
121
|
-
function readBytes(str, len) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
var wasHighSurrogate = false;
|
|
129
|
-
var escapedChars = 0;
|
|
105
|
+
function readBytes(str, len, escapedString = false) {
|
|
106
|
+
let bytes = 0
|
|
107
|
+
let out = ''
|
|
108
|
+
let c = 0
|
|
109
|
+
const strLen = str.length
|
|
110
|
+
let wasHighSurrogate = false
|
|
111
|
+
let escapedChars = 0
|
|
130
112
|
|
|
131
113
|
while (bytes < len && c < strLen) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
114
|
+
let chr = str.charAt(c)
|
|
115
|
+
const code = chr.charCodeAt(0)
|
|
116
|
+
const isHighSurrogate = code >= 0xd800 && code <= 0xdbff
|
|
117
|
+
const isLowSurrogate = code >= 0xdc00 && code <= 0xdfff
|
|
136
118
|
|
|
137
119
|
if (escapedString && chr === '\\') {
|
|
138
|
-
chr = String.fromCharCode(parseInt(str.substr(c + 1, 2), 16))
|
|
139
|
-
escapedChars
|
|
120
|
+
chr = String.fromCharCode(parseInt(str.substr(c + 1, 2), 16))
|
|
121
|
+
escapedChars++
|
|
140
122
|
|
|
141
123
|
// each escaped sequence is 3 characters. Go 2 chars ahead.
|
|
142
124
|
// third character will be jumped over a few lines later
|
|
143
|
-
c += 2
|
|
125
|
+
c += 2
|
|
144
126
|
}
|
|
145
127
|
|
|
146
|
-
c
|
|
128
|
+
c++
|
|
147
129
|
|
|
148
|
-
bytes +=
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
130
|
+
bytes +=
|
|
131
|
+
isHighSurrogate || (isLowSurrogate && wasHighSurrogate)
|
|
132
|
+
? // if high surrogate, count 2 bytes, as expectation is to be followed by low surrogate
|
|
133
|
+
// if low surrogate preceded by high surrogate, add 2 bytes
|
|
134
|
+
2
|
|
135
|
+
: code > 0x7ff
|
|
136
|
+
? // otherwise low surrogate falls into this part
|
|
137
|
+
3
|
|
138
|
+
: code > 0x7f
|
|
139
|
+
? 2
|
|
140
|
+
: 1
|
|
152
141
|
|
|
153
142
|
// if high surrogate is not followed by low surrogate, add 1 more byte
|
|
154
|
-
bytes += wasHighSurrogate && !isLowSurrogate ? 1 : 0
|
|
143
|
+
bytes += wasHighSurrogate && !isLowSurrogate ? 1 : 0
|
|
155
144
|
|
|
156
|
-
out += chr
|
|
157
|
-
wasHighSurrogate = isHighSurrogate
|
|
145
|
+
out += chr
|
|
146
|
+
wasHighSurrogate = isHighSurrogate
|
|
158
147
|
}
|
|
159
148
|
|
|
160
|
-
return [out, bytes, escapedChars]
|
|
149
|
+
return [out, bytes, escapedChars]
|
|
161
150
|
}
|
|
162
151
|
|
|
163
152
|
function expectString(str) {
|
|
164
153
|
// PHP strings consist of one-byte characters.
|
|
165
154
|
// JS uses 2 bytes with possible surrogate pairs.
|
|
166
155
|
// Serialized length of 2 is still 1 JS string character
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
var _ref7 = reStrLength.exec(str) || [],
|
|
170
|
-
_ref8 = _slicedToArray(_ref7, 2),
|
|
171
|
-
match = _ref8[0],
|
|
172
|
-
byteLenMatch = _ref8[1];
|
|
156
|
+
const reStrLength = /^s:(\d+):"/g // also match the opening " char
|
|
157
|
+
const [match, byteLenMatch] = reStrLength.exec(str) || []
|
|
173
158
|
|
|
174
159
|
if (!match) {
|
|
175
|
-
throw SyntaxError('Expected a string value')
|
|
160
|
+
throw new SyntaxError('Expected a string value')
|
|
176
161
|
}
|
|
177
162
|
|
|
178
|
-
|
|
163
|
+
const len = parseInt(byteLenMatch, 10)
|
|
179
164
|
|
|
180
|
-
str = str.substr(match.length)
|
|
165
|
+
str = str.substr(match.length)
|
|
181
166
|
|
|
182
|
-
|
|
183
|
-
_readBytes2 = _slicedToArray(_readBytes, 2),
|
|
184
|
-
strMatch = _readBytes2[0],
|
|
185
|
-
bytes = _readBytes2[1];
|
|
167
|
+
const [strMatch, bytes] = readBytes(str, len)
|
|
186
168
|
|
|
187
169
|
if (bytes !== len) {
|
|
188
|
-
throw SyntaxError(
|
|
170
|
+
throw new SyntaxError(`Expected string of ${len} bytes, but got ${bytes}`)
|
|
189
171
|
}
|
|
190
172
|
|
|
191
|
-
str = str.substr(strMatch.length)
|
|
173
|
+
str = str.substr(strMatch.length)
|
|
192
174
|
|
|
193
175
|
// strict parsing, match closing "; chars
|
|
194
176
|
if (!str.startsWith('";')) {
|
|
195
|
-
throw SyntaxError('Expected ";')
|
|
177
|
+
throw new SyntaxError('Expected ";')
|
|
196
178
|
}
|
|
197
179
|
|
|
198
|
-
return [strMatch, match.length + strMatch.length + 2]
|
|
180
|
+
return [strMatch, match.length + strMatch.length + 2] // skip last ";
|
|
199
181
|
}
|
|
200
182
|
|
|
201
183
|
function expectEscapedString(str) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
var _ref9 = reStrLength.exec(str) || [],
|
|
205
|
-
_ref10 = _slicedToArray(_ref9, 2),
|
|
206
|
-
match = _ref10[0],
|
|
207
|
-
strLenMatch = _ref10[1];
|
|
184
|
+
const reStrLength = /^S:(\d+):"/g // also match the opening " char
|
|
185
|
+
const [match, strLenMatch] = reStrLength.exec(str) || []
|
|
208
186
|
|
|
209
187
|
if (!match) {
|
|
210
|
-
throw SyntaxError('Expected an escaped string value')
|
|
188
|
+
throw new SyntaxError('Expected an escaped string value')
|
|
211
189
|
}
|
|
212
190
|
|
|
213
|
-
|
|
191
|
+
const len = parseInt(strLenMatch, 10)
|
|
214
192
|
|
|
215
|
-
str = str.substr(match.length)
|
|
193
|
+
str = str.substr(match.length)
|
|
216
194
|
|
|
217
|
-
|
|
218
|
-
_readBytes4 = _slicedToArray(_readBytes3, 3),
|
|
219
|
-
strMatch = _readBytes4[0],
|
|
220
|
-
bytes = _readBytes4[1],
|
|
221
|
-
escapedChars = _readBytes4[2];
|
|
195
|
+
const [strMatch, bytes, escapedChars] = readBytes(str, len, true)
|
|
222
196
|
|
|
223
197
|
if (bytes !== len) {
|
|
224
|
-
throw SyntaxError(
|
|
198
|
+
throw new SyntaxError(`Expected escaped string of ${len} bytes, but got ${bytes}`)
|
|
225
199
|
}
|
|
226
200
|
|
|
227
|
-
str = str.substr(strMatch.length + escapedChars * 2)
|
|
201
|
+
str = str.substr(strMatch.length + escapedChars * 2)
|
|
228
202
|
|
|
229
203
|
// strict parsing, match closing "; chars
|
|
230
204
|
if (!str.startsWith('";')) {
|
|
231
|
-
throw SyntaxError('Expected ";')
|
|
205
|
+
throw new SyntaxError('Expected ";')
|
|
232
206
|
}
|
|
233
207
|
|
|
234
|
-
return [strMatch, match.length + strMatch.length + 2]
|
|
208
|
+
return [strMatch, match.length + strMatch.length + 2] // skip last ";
|
|
235
209
|
}
|
|
236
210
|
|
|
237
211
|
function expectKeyOrIndex(str) {
|
|
238
212
|
try {
|
|
239
|
-
return expectString(str)
|
|
240
|
-
|
|
213
|
+
return expectString(str)
|
|
214
|
+
// biome-ignore lint/suspicious/noEmptyBlockStatements: fallthrough to next parser
|
|
215
|
+
} catch (_err) {}
|
|
241
216
|
|
|
242
217
|
try {
|
|
243
|
-
return expectEscapedString(str)
|
|
244
|
-
|
|
218
|
+
return expectEscapedString(str)
|
|
219
|
+
// biome-ignore lint/suspicious/noEmptyBlockStatements: fallthrough to next parser
|
|
220
|
+
} catch (_err) {}
|
|
245
221
|
|
|
246
222
|
try {
|
|
247
|
-
return expectInt(str)
|
|
248
|
-
} catch (
|
|
249
|
-
throw SyntaxError('Expected key or index')
|
|
223
|
+
return expectInt(str)
|
|
224
|
+
} catch (_err) {
|
|
225
|
+
throw new SyntaxError('Expected key or index')
|
|
250
226
|
}
|
|
251
227
|
}
|
|
252
228
|
|
|
253
229
|
function expectObject(str, cache) {
|
|
254
230
|
// O:<class name length>:"class name":<prop count>:{<props and values>}
|
|
255
231
|
// O:8:"stdClass":2:{s:3:"foo";s:3:"bar";s:3:"bar";s:3:"baz";}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
_ref12 = _slicedToArray(_ref11, 4),
|
|
260
|
-
objectLiteralBeginMatch /* classNameLengthMatch */ = _ref12[0],
|
|
261
|
-
className = _ref12[2],
|
|
262
|
-
propCountMatch = _ref12[3];
|
|
232
|
+
const reObjectLiteral = /^O:(\d+):"([^"]+)":(\d+):\{/
|
|
233
|
+
const [objectLiteralBeginMatch /* classNameLengthMatch */, , className, propCountMatch] =
|
|
234
|
+
reObjectLiteral.exec(str) || []
|
|
263
235
|
|
|
264
236
|
if (!objectLiteralBeginMatch) {
|
|
265
|
-
throw SyntaxError('Invalid input')
|
|
237
|
+
throw new SyntaxError('Invalid input')
|
|
266
238
|
}
|
|
267
239
|
|
|
268
240
|
if (className !== 'stdClass') {
|
|
269
|
-
throw SyntaxError(
|
|
241
|
+
throw new SyntaxError(`Unsupported object type: ${className}`)
|
|
270
242
|
}
|
|
271
243
|
|
|
272
|
-
|
|
244
|
+
let totalOffset = objectLiteralBeginMatch.length
|
|
273
245
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
cache([obj])
|
|
246
|
+
const propCount = parseInt(propCountMatch, 10)
|
|
247
|
+
const obj = {}
|
|
248
|
+
cache([obj])
|
|
277
249
|
|
|
278
|
-
str = str.substr(totalOffset)
|
|
250
|
+
str = str.substr(totalOffset)
|
|
279
251
|
|
|
280
|
-
for (
|
|
281
|
-
|
|
282
|
-
str = str.substr(prop[1])
|
|
283
|
-
totalOffset += prop[1]
|
|
252
|
+
for (let i = 0; i < propCount; i++) {
|
|
253
|
+
const prop = expectKeyOrIndex(str)
|
|
254
|
+
str = str.substr(prop[1])
|
|
255
|
+
totalOffset += prop[1]
|
|
284
256
|
|
|
285
|
-
|
|
286
|
-
str = str.substr(value[1])
|
|
287
|
-
totalOffset += value[1]
|
|
257
|
+
const value = expectType(str, cache)
|
|
258
|
+
str = str.substr(value[1])
|
|
259
|
+
totalOffset += value[1]
|
|
288
260
|
|
|
289
|
-
obj[prop[0]] = value[0]
|
|
261
|
+
obj[prop[0]] = value[0]
|
|
290
262
|
}
|
|
291
263
|
|
|
292
264
|
// strict parsing, expect } after object literal
|
|
293
265
|
if (str.charAt(0) !== '}') {
|
|
294
|
-
throw SyntaxError('Expected }')
|
|
266
|
+
throw new SyntaxError('Expected }')
|
|
295
267
|
}
|
|
296
268
|
|
|
297
|
-
return [obj, totalOffset + 1]
|
|
269
|
+
return [obj, totalOffset + 1] // skip final }
|
|
298
270
|
}
|
|
299
271
|
|
|
300
272
|
function expectClass(str, cache) {
|
|
@@ -303,87 +275,77 @@ function expectClass(str, cache) {
|
|
|
303
275
|
// which is unsafe
|
|
304
276
|
// or assume that constructor is defined in global scope
|
|
305
277
|
// but this is too much limiting
|
|
306
|
-
throw Error('Not yet implemented')
|
|
278
|
+
throw new Error('Not yet implemented')
|
|
307
279
|
}
|
|
308
280
|
|
|
309
281
|
function expectReference(str, cache) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
var _ref13 = reRef.exec(str) || [],
|
|
313
|
-
_ref14 = _slicedToArray(_ref13, 2),
|
|
314
|
-
match = _ref14[0],
|
|
315
|
-
refIndex = _ref14[1];
|
|
282
|
+
const reRef = /^[rR]:([1-9]\d*);/
|
|
283
|
+
const [match, refIndex] = reRef.exec(str) || []
|
|
316
284
|
|
|
317
285
|
if (!match) {
|
|
318
|
-
throw SyntaxError('Expected reference value')
|
|
286
|
+
throw new SyntaxError('Expected reference value')
|
|
319
287
|
}
|
|
320
288
|
|
|
321
|
-
return [cache.get(parseInt(refIndex, 10) - 1), match.length]
|
|
289
|
+
return [cache.get(parseInt(refIndex, 10) - 1), match.length]
|
|
322
290
|
}
|
|
323
291
|
|
|
324
292
|
function expectArray(str, cache) {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
var _ref15 = reArrayLength.exec(str) || [],
|
|
328
|
-
_ref16 = _slicedToArray(_ref15, 2),
|
|
329
|
-
arrayLiteralBeginMatch = _ref16[0],
|
|
330
|
-
arrayLengthMatch = _ref16[1];
|
|
293
|
+
const reArrayLength = /^a:(\d+):{/
|
|
294
|
+
const [arrayLiteralBeginMatch, arrayLengthMatch] = reArrayLength.exec(str) || []
|
|
331
295
|
|
|
332
296
|
if (!arrayLengthMatch) {
|
|
333
|
-
throw SyntaxError('Expected array length annotation')
|
|
297
|
+
throw new SyntaxError('Expected array length annotation')
|
|
334
298
|
}
|
|
335
299
|
|
|
336
|
-
str = str.substr(arrayLiteralBeginMatch.length)
|
|
300
|
+
str = str.substr(arrayLiteralBeginMatch.length)
|
|
337
301
|
|
|
338
|
-
|
|
302
|
+
const array = expectArrayItems(str, parseInt(arrayLengthMatch, 10), cache)
|
|
339
303
|
|
|
340
304
|
// strict parsing, expect closing } brace after array literal
|
|
341
305
|
if (str.charAt(array[1]) !== '}') {
|
|
342
|
-
throw SyntaxError('Expected }')
|
|
306
|
+
throw new SyntaxError('Expected }')
|
|
343
307
|
}
|
|
344
308
|
|
|
345
|
-
return [array[0], arrayLiteralBeginMatch.length + array[1] + 1]
|
|
309
|
+
return [array[0], arrayLiteralBeginMatch.length + array[1] + 1] // jump over }
|
|
346
310
|
}
|
|
347
311
|
|
|
348
|
-
function expectArrayItems(str) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
var lastIndex = -1;
|
|
357
|
-
var items = {};
|
|
358
|
-
cache([items]);
|
|
312
|
+
function expectArrayItems(str, expectedItems = 0, cache) {
|
|
313
|
+
let key
|
|
314
|
+
let item
|
|
315
|
+
let totalOffset = 0
|
|
316
|
+
let hasContinousIndexes = true
|
|
317
|
+
let lastIndex = -1
|
|
318
|
+
let items = {}
|
|
319
|
+
cache([items])
|
|
359
320
|
|
|
360
|
-
for (
|
|
361
|
-
key = expectKeyOrIndex(str)
|
|
321
|
+
for (let i = 0; i < expectedItems; i++) {
|
|
322
|
+
key = expectKeyOrIndex(str)
|
|
362
323
|
|
|
363
|
-
hasContinousIndexes = hasContinousIndexes && typeof key[0] === 'number' && key[0] === lastIndex + 1
|
|
364
|
-
lastIndex = key[0]
|
|
324
|
+
hasContinousIndexes = hasContinousIndexes && typeof key[0] === 'number' && key[0] === lastIndex + 1
|
|
325
|
+
lastIndex = key[0]
|
|
365
326
|
|
|
366
|
-
str = str.substr(key[1])
|
|
367
|
-
totalOffset += key[1]
|
|
327
|
+
str = str.substr(key[1])
|
|
328
|
+
totalOffset += key[1]
|
|
368
329
|
|
|
369
330
|
// references are resolved immediately, so if duplicate key overwrites previous array index
|
|
370
331
|
// the old value is anyway resolved
|
|
371
332
|
// fixme: but next time the same reference should point to the new value
|
|
372
|
-
item = expectType(str, cache)
|
|
373
|
-
str = str.substr(item[1])
|
|
374
|
-
totalOffset += item[1]
|
|
333
|
+
item = expectType(str, cache)
|
|
334
|
+
str = str.substr(item[1])
|
|
335
|
+
totalOffset += item[1]
|
|
375
336
|
|
|
376
|
-
items[key[0]] = item[0]
|
|
337
|
+
items[key[0]] = item[0]
|
|
377
338
|
}
|
|
378
339
|
|
|
379
340
|
if (hasContinousIndexes) {
|
|
380
|
-
items = Object.values(items)
|
|
341
|
+
items = Object.values(items)
|
|
381
342
|
}
|
|
382
343
|
|
|
383
|
-
return [items, totalOffset]
|
|
344
|
+
return [items, totalOffset]
|
|
384
345
|
}
|
|
385
346
|
|
|
386
|
-
|
|
347
|
+
// errorMode: 'throw', 'log', 'silent'
|
|
348
|
+
module.exports = function unserialize(str, errorMode = 'log') {
|
|
387
349
|
// discuss at: https://locutus.io/php/unserialize/
|
|
388
350
|
// original by: Arpad Ray (mailto:arpad@php.net)
|
|
389
351
|
// improved by: Pedro Tainha (https://www.pedrotainha.com)
|
|
@@ -425,13 +387,17 @@ module.exports = function unserialize(str) {
|
|
|
425
387
|
|
|
426
388
|
try {
|
|
427
389
|
if (typeof str !== 'string') {
|
|
428
|
-
return false
|
|
390
|
+
return false
|
|
429
391
|
}
|
|
430
392
|
|
|
431
|
-
return expectType(str, initCache())[0]
|
|
393
|
+
return expectType(str, initCache())[0]
|
|
432
394
|
} catch (err) {
|
|
433
|
-
|
|
434
|
-
|
|
395
|
+
if (errorMode === 'throw') {
|
|
396
|
+
throw err
|
|
397
|
+
} else if (errorMode === 'log') {
|
|
398
|
+
console.error(err)
|
|
399
|
+
}
|
|
400
|
+
// if silent mode we do nothing
|
|
401
|
+
return false
|
|
435
402
|
}
|
|
436
|
-
}
|
|
437
|
-
//# sourceMappingURL=unserialize.js.map
|
|
403
|
+
}
|