locutus 2.0.32 → 2.0.35
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 +18 -0
- package/_data/rosetta.yml +325 -0
- package/awk/builtin/index.js +5 -0
- package/awk/builtin/int.js +13 -0
- package/awk/builtin/length.js +16 -0
- package/awk/builtin/substr.js +23 -0
- package/awk/builtin/tolower.js +11 -0
- package/awk/builtin/toupper.js +11 -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/lua/string/index.js +3 -0
- package/lua/string/lower.js +11 -0
- package/lua/string/sub.js +33 -0
- package/lua/string/upper.js +11 -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 +9 -11
- package/php/filesystem/file_get_contents.js +3 -6
- package/php/filesystem/index.js +6 -9
- 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_exists.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/misc/pack.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
module.exports = function pack(format) {
|
|
4
2
|
// discuss at: https://locutus.io/php/pack/
|
|
5
3
|
// original by: Tim de Koning (https://www.kingsquare.nl)
|
|
@@ -19,50 +17,49 @@ module.exports = function pack(format) {
|
|
|
19
17
|
// returns 3: 'Õ'
|
|
20
18
|
// example 4: pack('d', -100.876)
|
|
21
19
|
// returns 4: "\u0000\u0000\u0000\u0000\u00008YÀ"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
extraNullCount = void 0;
|
|
20
|
+
|
|
21
|
+
let formatPointer = 0
|
|
22
|
+
let argumentPointer = 1
|
|
23
|
+
let result = ''
|
|
24
|
+
let argument = ''
|
|
25
|
+
let i = 0
|
|
26
|
+
let r = []
|
|
27
|
+
let instruction
|
|
28
|
+
let quantifier
|
|
29
|
+
let word
|
|
30
|
+
let precisionBits
|
|
31
|
+
let exponentBits
|
|
32
|
+
let extraNullCount
|
|
36
33
|
|
|
37
34
|
// vars used by float encoding
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
35
|
+
let bias
|
|
36
|
+
let minExp
|
|
37
|
+
let maxExp
|
|
38
|
+
let minUnnormExp
|
|
39
|
+
let status
|
|
40
|
+
let exp
|
|
41
|
+
let len
|
|
42
|
+
let bin
|
|
43
|
+
let signal
|
|
44
|
+
let n
|
|
45
|
+
let intPart
|
|
46
|
+
let floatPart
|
|
47
|
+
let lastBit
|
|
48
|
+
let rounded
|
|
49
|
+
let j
|
|
50
|
+
let k
|
|
51
|
+
let tmpResult
|
|
55
52
|
|
|
56
53
|
while (formatPointer < format.length) {
|
|
57
|
-
instruction = format.charAt(formatPointer)
|
|
58
|
-
quantifier = ''
|
|
59
|
-
formatPointer
|
|
54
|
+
instruction = format.charAt(formatPointer)
|
|
55
|
+
quantifier = ''
|
|
56
|
+
formatPointer++
|
|
60
57
|
while (formatPointer < format.length && format.charAt(formatPointer).match(/[\d*]/) !== null) {
|
|
61
|
-
quantifier += format.charAt(formatPointer)
|
|
62
|
-
formatPointer
|
|
58
|
+
quantifier += format.charAt(formatPointer)
|
|
59
|
+
formatPointer++
|
|
63
60
|
}
|
|
64
61
|
if (quantifier === '') {
|
|
65
|
-
quantifier = '1'
|
|
62
|
+
quantifier = '1'
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
// Now pack variables: 'quantifier' times 'instruction'
|
|
@@ -72,59 +69,59 @@ module.exports = function pack(format) {
|
|
|
72
69
|
// NUL-padded string
|
|
73
70
|
// SPACE-padded string
|
|
74
71
|
if (typeof arguments[argumentPointer] === 'undefined') {
|
|
75
|
-
throw new Error('Warning: pack() Type ' + instruction + ': not enough arguments')
|
|
72
|
+
throw new Error('Warning: pack() Type ' + instruction + ': not enough arguments')
|
|
76
73
|
} else {
|
|
77
|
-
argument = String(arguments[argumentPointer])
|
|
74
|
+
argument = String(arguments[argumentPointer])
|
|
78
75
|
}
|
|
79
76
|
if (quantifier === '*') {
|
|
80
|
-
quantifier = argument.length
|
|
77
|
+
quantifier = argument.length
|
|
81
78
|
}
|
|
82
79
|
for (i = 0; i < quantifier; i++) {
|
|
83
80
|
if (typeof argument[i] === 'undefined') {
|
|
84
81
|
if (instruction === 'a') {
|
|
85
|
-
result += String.fromCharCode(0)
|
|
82
|
+
result += String.fromCharCode(0)
|
|
86
83
|
} else {
|
|
87
|
-
result += ' '
|
|
84
|
+
result += ' '
|
|
88
85
|
}
|
|
89
86
|
} else {
|
|
90
|
-
result += argument[i]
|
|
87
|
+
result += argument[i]
|
|
91
88
|
}
|
|
92
89
|
}
|
|
93
|
-
argumentPointer
|
|
94
|
-
break
|
|
90
|
+
argumentPointer++
|
|
91
|
+
break
|
|
95
92
|
case 'h':
|
|
96
93
|
case 'H':
|
|
97
94
|
// Hex string, low nibble first
|
|
98
95
|
// Hex string, high nibble first
|
|
99
96
|
if (typeof arguments[argumentPointer] === 'undefined') {
|
|
100
|
-
throw new Error('Warning: pack() Type ' + instruction + ': not enough arguments')
|
|
97
|
+
throw new Error('Warning: pack() Type ' + instruction + ': not enough arguments')
|
|
101
98
|
} else {
|
|
102
|
-
argument = arguments[argumentPointer]
|
|
99
|
+
argument = arguments[argumentPointer]
|
|
103
100
|
}
|
|
104
101
|
if (quantifier === '*') {
|
|
105
|
-
quantifier = argument.length
|
|
102
|
+
quantifier = argument.length
|
|
106
103
|
}
|
|
107
104
|
if (quantifier > argument.length) {
|
|
108
|
-
|
|
109
|
-
throw new Error(msg)
|
|
105
|
+
const msg = 'Warning: pack() Type ' + instruction + ': not enough characters in string'
|
|
106
|
+
throw new Error(msg)
|
|
110
107
|
}
|
|
111
108
|
|
|
112
109
|
for (i = 0; i < quantifier; i += 2) {
|
|
113
110
|
// Always get per 2 bytes...
|
|
114
|
-
word = argument[i]
|
|
111
|
+
word = argument[i]
|
|
115
112
|
if (i + 1 >= quantifier || typeof argument[i + 1] === 'undefined') {
|
|
116
|
-
word += '0'
|
|
113
|
+
word += '0'
|
|
117
114
|
} else {
|
|
118
|
-
word += argument[i + 1]
|
|
115
|
+
word += argument[i + 1]
|
|
119
116
|
}
|
|
120
117
|
// The fastest way to reverse?
|
|
121
118
|
if (instruction === 'h') {
|
|
122
|
-
word = word[1] + word[0]
|
|
119
|
+
word = word[1] + word[0]
|
|
123
120
|
}
|
|
124
|
-
result += String.fromCharCode(parseInt(word, 16))
|
|
121
|
+
result += String.fromCharCode(parseInt(word, 16))
|
|
125
122
|
}
|
|
126
|
-
argumentPointer
|
|
127
|
-
break
|
|
123
|
+
argumentPointer++
|
|
124
|
+
break
|
|
128
125
|
|
|
129
126
|
case 'c':
|
|
130
127
|
case 'C':
|
|
@@ -132,17 +129,17 @@ module.exports = function pack(format) {
|
|
|
132
129
|
// unsigned char
|
|
133
130
|
// c and C is the same in pack
|
|
134
131
|
if (quantifier === '*') {
|
|
135
|
-
quantifier = arguments.length - argumentPointer
|
|
132
|
+
quantifier = arguments.length - argumentPointer
|
|
136
133
|
}
|
|
137
134
|
if (quantifier > arguments.length - argumentPointer) {
|
|
138
|
-
throw new Error('Warning: pack() Type ' + instruction + ': too few arguments')
|
|
135
|
+
throw new Error('Warning: pack() Type ' + instruction + ': too few arguments')
|
|
139
136
|
}
|
|
140
137
|
|
|
141
138
|
for (i = 0; i < quantifier; i++) {
|
|
142
|
-
result += String.fromCharCode(arguments[argumentPointer])
|
|
143
|
-
argumentPointer
|
|
139
|
+
result += String.fromCharCode(arguments[argumentPointer])
|
|
140
|
+
argumentPointer++
|
|
144
141
|
}
|
|
145
|
-
break
|
|
142
|
+
break
|
|
146
143
|
|
|
147
144
|
case 's':
|
|
148
145
|
case 'S':
|
|
@@ -151,34 +148,34 @@ module.exports = function pack(format) {
|
|
|
151
148
|
// unsigned short (always 16 bit, machine byte order)
|
|
152
149
|
// s and S is the same in pack
|
|
153
150
|
if (quantifier === '*') {
|
|
154
|
-
quantifier = arguments.length - argumentPointer
|
|
151
|
+
quantifier = arguments.length - argumentPointer
|
|
155
152
|
}
|
|
156
153
|
if (quantifier > arguments.length - argumentPointer) {
|
|
157
|
-
throw new Error('Warning: pack() Type ' + instruction + ': too few arguments')
|
|
154
|
+
throw new Error('Warning: pack() Type ' + instruction + ': too few arguments')
|
|
158
155
|
}
|
|
159
156
|
|
|
160
157
|
for (i = 0; i < quantifier; i++) {
|
|
161
|
-
result += String.fromCharCode(arguments[argumentPointer] & 0xff)
|
|
162
|
-
result += String.fromCharCode(arguments[argumentPointer] >> 8 & 0xff)
|
|
163
|
-
argumentPointer
|
|
158
|
+
result += String.fromCharCode(arguments[argumentPointer] & 0xff)
|
|
159
|
+
result += String.fromCharCode((arguments[argumentPointer] >> 8) & 0xff)
|
|
160
|
+
argumentPointer++
|
|
164
161
|
}
|
|
165
|
-
break
|
|
162
|
+
break
|
|
166
163
|
|
|
167
164
|
case 'n':
|
|
168
165
|
// unsigned short (always 16 bit, big endian byte order)
|
|
169
166
|
if (quantifier === '*') {
|
|
170
|
-
quantifier = arguments.length - argumentPointer
|
|
167
|
+
quantifier = arguments.length - argumentPointer
|
|
171
168
|
}
|
|
172
169
|
if (quantifier > arguments.length - argumentPointer) {
|
|
173
|
-
throw new Error('Warning: pack() Type ' + instruction + ': too few arguments')
|
|
170
|
+
throw new Error('Warning: pack() Type ' + instruction + ': too few arguments')
|
|
174
171
|
}
|
|
175
172
|
|
|
176
173
|
for (i = 0; i < quantifier; i++) {
|
|
177
|
-
result += String.fromCharCode(arguments[argumentPointer] >> 8 & 0xff)
|
|
178
|
-
result += String.fromCharCode(arguments[argumentPointer] & 0xff)
|
|
179
|
-
argumentPointer
|
|
174
|
+
result += String.fromCharCode((arguments[argumentPointer] >> 8) & 0xff)
|
|
175
|
+
result += String.fromCharCode(arguments[argumentPointer] & 0xff)
|
|
176
|
+
argumentPointer++
|
|
180
177
|
}
|
|
181
|
-
break
|
|
178
|
+
break
|
|
182
179
|
|
|
183
180
|
case 'i':
|
|
184
181
|
case 'I':
|
|
@@ -191,194 +188,205 @@ module.exports = function pack(format) {
|
|
|
191
188
|
// unsigned long (always 32 bit, machine byte order)
|
|
192
189
|
// unsigned long (always 32 bit, little endian byte order)
|
|
193
190
|
if (quantifier === '*') {
|
|
194
|
-
quantifier = arguments.length - argumentPointer
|
|
191
|
+
quantifier = arguments.length - argumentPointer
|
|
195
192
|
}
|
|
196
193
|
if (quantifier > arguments.length - argumentPointer) {
|
|
197
|
-
throw new Error('Warning: pack() Type ' + instruction + ': too few arguments')
|
|
194
|
+
throw new Error('Warning: pack() Type ' + instruction + ': too few arguments')
|
|
198
195
|
}
|
|
199
196
|
|
|
200
197
|
for (i = 0; i < quantifier; i++) {
|
|
201
|
-
result += String.fromCharCode(arguments[argumentPointer] & 0xff)
|
|
202
|
-
result += String.fromCharCode(arguments[argumentPointer] >> 8 & 0xff)
|
|
203
|
-
result += String.fromCharCode(arguments[argumentPointer] >> 16 & 0xff)
|
|
204
|
-
result += String.fromCharCode(arguments[argumentPointer] >> 24 & 0xff)
|
|
205
|
-
argumentPointer
|
|
198
|
+
result += String.fromCharCode(arguments[argumentPointer] & 0xff)
|
|
199
|
+
result += String.fromCharCode((arguments[argumentPointer] >> 8) & 0xff)
|
|
200
|
+
result += String.fromCharCode((arguments[argumentPointer] >> 16) & 0xff)
|
|
201
|
+
result += String.fromCharCode((arguments[argumentPointer] >> 24) & 0xff)
|
|
202
|
+
argumentPointer++
|
|
206
203
|
}
|
|
207
204
|
|
|
208
|
-
break
|
|
205
|
+
break
|
|
209
206
|
case 'N':
|
|
210
207
|
// unsigned long (always 32 bit, big endian byte order)
|
|
211
208
|
if (quantifier === '*') {
|
|
212
|
-
quantifier = arguments.length - argumentPointer
|
|
209
|
+
quantifier = arguments.length - argumentPointer
|
|
213
210
|
}
|
|
214
211
|
if (quantifier > arguments.length - argumentPointer) {
|
|
215
|
-
throw new Error('Warning: pack() Type ' + instruction + ': too few arguments')
|
|
212
|
+
throw new Error('Warning: pack() Type ' + instruction + ': too few arguments')
|
|
216
213
|
}
|
|
217
214
|
|
|
218
215
|
for (i = 0; i < quantifier; i++) {
|
|
219
|
-
result += String.fromCharCode(arguments[argumentPointer] >> 24 & 0xff)
|
|
220
|
-
result += String.fromCharCode(arguments[argumentPointer] >> 16 & 0xff)
|
|
221
|
-
result += String.fromCharCode(arguments[argumentPointer] >> 8 & 0xff)
|
|
222
|
-
result += String.fromCharCode(arguments[argumentPointer] & 0xff)
|
|
223
|
-
argumentPointer
|
|
216
|
+
result += String.fromCharCode((arguments[argumentPointer] >> 24) & 0xff)
|
|
217
|
+
result += String.fromCharCode((arguments[argumentPointer] >> 16) & 0xff)
|
|
218
|
+
result += String.fromCharCode((arguments[argumentPointer] >> 8) & 0xff)
|
|
219
|
+
result += String.fromCharCode(arguments[argumentPointer] & 0xff)
|
|
220
|
+
argumentPointer++
|
|
224
221
|
}
|
|
225
|
-
break
|
|
222
|
+
break
|
|
226
223
|
|
|
227
224
|
case 'f':
|
|
228
225
|
case 'd':
|
|
229
226
|
// float (machine dependent size and representation)
|
|
230
227
|
// double (machine dependent size and representation)
|
|
231
228
|
// version based on IEEE754
|
|
232
|
-
precisionBits = 23
|
|
233
|
-
exponentBits = 8
|
|
229
|
+
precisionBits = 23
|
|
230
|
+
exponentBits = 8
|
|
234
231
|
if (instruction === 'd') {
|
|
235
|
-
precisionBits = 52
|
|
236
|
-
exponentBits = 11
|
|
232
|
+
precisionBits = 52
|
|
233
|
+
exponentBits = 11
|
|
237
234
|
}
|
|
238
235
|
|
|
239
236
|
if (quantifier === '*') {
|
|
240
|
-
quantifier = arguments.length - argumentPointer
|
|
237
|
+
quantifier = arguments.length - argumentPointer
|
|
241
238
|
}
|
|
242
239
|
if (quantifier > arguments.length - argumentPointer) {
|
|
243
|
-
throw new Error('Warning: pack() Type ' + instruction + ': too few arguments')
|
|
240
|
+
throw new Error('Warning: pack() Type ' + instruction + ': too few arguments')
|
|
244
241
|
}
|
|
245
242
|
for (i = 0; i < quantifier; i++) {
|
|
246
|
-
argument = arguments[argumentPointer]
|
|
247
|
-
bias = Math.pow(2, exponentBits - 1) - 1
|
|
248
|
-
minExp = -bias + 1
|
|
249
|
-
maxExp = bias
|
|
250
|
-
minUnnormExp = minExp - precisionBits
|
|
251
|
-
status = isNaN(n = parseFloat(argument)) || n === -Infinity || n === +Infinity ? n : 0
|
|
252
|
-
exp = 0
|
|
253
|
-
len = 2 * bias + 1 + precisionBits + 3
|
|
254
|
-
bin = new Array(len)
|
|
255
|
-
signal = (n = status !== 0 ? 0 : n) < 0
|
|
256
|
-
n = Math.abs(n)
|
|
257
|
-
intPart = Math.floor(n)
|
|
258
|
-
floatPart = n - intPart
|
|
259
|
-
|
|
260
|
-
for (k = len; k;) {
|
|
261
|
-
bin[--k] = 0
|
|
243
|
+
argument = arguments[argumentPointer]
|
|
244
|
+
bias = Math.pow(2, exponentBits - 1) - 1
|
|
245
|
+
minExp = -bias + 1
|
|
246
|
+
maxExp = bias
|
|
247
|
+
minUnnormExp = minExp - precisionBits
|
|
248
|
+
status = isNaN((n = parseFloat(argument))) || n === -Infinity || n === +Infinity ? n : 0
|
|
249
|
+
exp = 0
|
|
250
|
+
len = 2 * bias + 1 + precisionBits + 3
|
|
251
|
+
bin = new Array(len)
|
|
252
|
+
signal = (n = status !== 0 ? 0 : n) < 0
|
|
253
|
+
n = Math.abs(n)
|
|
254
|
+
intPart = Math.floor(n)
|
|
255
|
+
floatPart = n - intPart
|
|
256
|
+
|
|
257
|
+
for (k = len; k; ) {
|
|
258
|
+
bin[--k] = 0
|
|
262
259
|
}
|
|
263
|
-
for (k = bias + 2; intPart && k;) {
|
|
264
|
-
bin[--k] = intPart % 2
|
|
265
|
-
intPart = Math.floor(intPart / 2)
|
|
260
|
+
for (k = bias + 2; intPart && k; ) {
|
|
261
|
+
bin[--k] = intPart % 2
|
|
262
|
+
intPart = Math.floor(intPart / 2)
|
|
266
263
|
}
|
|
267
264
|
for (k = bias + 1; floatPart > 0 && k; --floatPart) {
|
|
268
|
-
bin[++k] = ((floatPart *= 2) >= 1) - 0
|
|
265
|
+
bin[++k] = ((floatPart *= 2) >= 1) - 0
|
|
266
|
+
}
|
|
267
|
+
for (k = -1; ++k < len && !bin[k]; ) {
|
|
268
|
+
/* skip leading zeros */
|
|
269
269
|
}
|
|
270
|
-
for (k = -1; ++k < len && !bin[k];) {}
|
|
271
270
|
|
|
272
271
|
// @todo: Make this more readable:
|
|
273
|
-
|
|
272
|
+
const key =
|
|
273
|
+
(lastBit =
|
|
274
|
+
precisionBits -
|
|
275
|
+
1 +
|
|
276
|
+
(k = (exp = bias + 1 - k) >= minExp && exp <= maxExp ? k + 1 : bias + 1 - (exp = minExp - 1))) + 1
|
|
274
277
|
|
|
275
278
|
if (bin[key]) {
|
|
276
279
|
if (!(rounded = bin[lastBit])) {
|
|
277
|
-
for (j = lastBit + 2; !rounded && j < len; rounded = bin[j++]) {
|
|
280
|
+
for (j = lastBit + 2; !rounded && j < len; rounded = bin[j++]) {
|
|
281
|
+
/* find if any trailing bit is set */
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
for (j = lastBit + 1; rounded && --j >= 0; (bin[j] = !bin[j] - 0) && (rounded = 0)) {
|
|
285
|
+
/* propagate rounding carry */
|
|
278
286
|
}
|
|
279
|
-
for (j = lastBit + 1; rounded && --j >= 0; (bin[j] = !bin[j] - 0) && (rounded = 0)) {}
|
|
280
287
|
}
|
|
281
288
|
|
|
282
|
-
for (k = k - 2 < 0 ? -1 : k - 3; ++k < len && !bin[k];) {
|
|
289
|
+
for (k = k - 2 < 0 ? -1 : k - 3; ++k < len && !bin[k]; ) {
|
|
290
|
+
/* skip leading zeros after rounding */
|
|
291
|
+
}
|
|
283
292
|
|
|
284
293
|
if ((exp = bias + 1 - k) >= minExp && exp <= maxExp) {
|
|
285
|
-
++k
|
|
294
|
+
++k
|
|
286
295
|
} else {
|
|
287
296
|
if (exp < minExp) {
|
|
288
297
|
if (exp !== bias + 1 - len && exp < minUnnormExp) {
|
|
289
298
|
// "encodeFloat::float underflow"
|
|
290
299
|
}
|
|
291
|
-
k = bias + 1 - (exp = minExp - 1)
|
|
300
|
+
k = bias + 1 - (exp = minExp - 1)
|
|
292
301
|
}
|
|
293
302
|
}
|
|
294
303
|
|
|
295
304
|
if (intPart || status !== 0) {
|
|
296
|
-
exp = maxExp + 1
|
|
297
|
-
k = bias + 2
|
|
305
|
+
exp = maxExp + 1
|
|
306
|
+
k = bias + 2
|
|
298
307
|
if (status === -Infinity) {
|
|
299
|
-
signal = 1
|
|
308
|
+
signal = 1
|
|
300
309
|
} else if (isNaN(status)) {
|
|
301
|
-
bin[k] = 1
|
|
310
|
+
bin[k] = 1
|
|
302
311
|
}
|
|
303
312
|
}
|
|
304
313
|
|
|
305
|
-
n = Math.abs(exp + bias)
|
|
306
|
-
tmpResult = ''
|
|
314
|
+
n = Math.abs(exp + bias)
|
|
315
|
+
tmpResult = ''
|
|
307
316
|
|
|
308
|
-
for (j = exponentBits + 1; --j;) {
|
|
309
|
-
tmpResult = n % 2 + tmpResult
|
|
310
|
-
n = n >>= 1
|
|
317
|
+
for (j = exponentBits + 1; --j; ) {
|
|
318
|
+
tmpResult = (n % 2) + tmpResult
|
|
319
|
+
n = n >>= 1
|
|
311
320
|
}
|
|
312
321
|
|
|
313
|
-
n = 0
|
|
314
|
-
j = 0
|
|
315
|
-
k = (tmpResult = (signal ? '1' : '0') + tmpResult + bin.slice(k, k + precisionBits).join('')).length
|
|
316
|
-
r = []
|
|
322
|
+
n = 0
|
|
323
|
+
j = 0
|
|
324
|
+
k = (tmpResult = (signal ? '1' : '0') + tmpResult + bin.slice(k, k + precisionBits).join('')).length
|
|
325
|
+
r = []
|
|
317
326
|
|
|
318
|
-
for (; k;) {
|
|
319
|
-
n += (1 << j) * tmpResult.charAt(--k)
|
|
327
|
+
for (; k; ) {
|
|
328
|
+
n += (1 << j) * tmpResult.charAt(--k)
|
|
320
329
|
if (j === 7) {
|
|
321
|
-
r[r.length] = String.fromCharCode(n)
|
|
322
|
-
n = 0
|
|
330
|
+
r[r.length] = String.fromCharCode(n)
|
|
331
|
+
n = 0
|
|
323
332
|
}
|
|
324
|
-
j = (j + 1) % 8
|
|
333
|
+
j = (j + 1) % 8
|
|
325
334
|
}
|
|
326
335
|
|
|
327
|
-
r[r.length] = n ? String.fromCharCode(n) : ''
|
|
328
|
-
result += r.join('')
|
|
329
|
-
argumentPointer
|
|
336
|
+
r[r.length] = n ? String.fromCharCode(n) : ''
|
|
337
|
+
result += r.join('')
|
|
338
|
+
argumentPointer++
|
|
330
339
|
}
|
|
331
|
-
break
|
|
340
|
+
break
|
|
332
341
|
|
|
333
342
|
case 'x':
|
|
334
343
|
// NUL byte
|
|
335
344
|
if (quantifier === '*') {
|
|
336
|
-
throw new Error("Warning: pack(): Type x: '*' ignored")
|
|
345
|
+
throw new Error("Warning: pack(): Type x: '*' ignored")
|
|
337
346
|
}
|
|
338
347
|
for (i = 0; i < quantifier; i++) {
|
|
339
|
-
result += String.fromCharCode(0)
|
|
348
|
+
result += String.fromCharCode(0)
|
|
340
349
|
}
|
|
341
|
-
break
|
|
350
|
+
break
|
|
342
351
|
|
|
343
352
|
case 'X':
|
|
344
353
|
// Back up one byte
|
|
345
354
|
if (quantifier === '*') {
|
|
346
|
-
throw new Error("Warning: pack(): Type X: '*' ignored")
|
|
355
|
+
throw new Error("Warning: pack(): Type X: '*' ignored")
|
|
347
356
|
}
|
|
348
357
|
for (i = 0; i < quantifier; i++) {
|
|
349
358
|
if (result.length === 0) {
|
|
350
|
-
throw new Error('Warning: pack(): Type X:' + ' outside of string')
|
|
359
|
+
throw new Error('Warning: pack(): Type X:' + ' outside of string')
|
|
351
360
|
} else {
|
|
352
|
-
result = result.substring(0, result.length - 1)
|
|
361
|
+
result = result.substring(0, result.length - 1)
|
|
353
362
|
}
|
|
354
363
|
}
|
|
355
|
-
break
|
|
364
|
+
break
|
|
356
365
|
|
|
357
366
|
case '@':
|
|
358
367
|
// NUL-fill to absolute position
|
|
359
368
|
if (quantifier === '*') {
|
|
360
|
-
throw new Error("Warning: pack(): Type X: '*' ignored")
|
|
369
|
+
throw new Error("Warning: pack(): Type X: '*' ignored")
|
|
361
370
|
}
|
|
362
371
|
if (quantifier > result.length) {
|
|
363
|
-
extraNullCount = quantifier - result.length
|
|
372
|
+
extraNullCount = quantifier - result.length
|
|
364
373
|
for (i = 0; i < extraNullCount; i++) {
|
|
365
|
-
result += String.fromCharCode(0)
|
|
374
|
+
result += String.fromCharCode(0)
|
|
366
375
|
}
|
|
367
376
|
}
|
|
368
377
|
if (quantifier < result.length) {
|
|
369
|
-
result = result.substring(0, quantifier)
|
|
378
|
+
result = result.substring(0, quantifier)
|
|
370
379
|
}
|
|
371
|
-
break
|
|
380
|
+
break
|
|
372
381
|
|
|
373
382
|
default:
|
|
374
|
-
throw new Error('Warning: pack() Type ' + instruction + ': unknown format code')
|
|
383
|
+
throw new Error('Warning: pack() Type ' + instruction + ': unknown format code')
|
|
375
384
|
}
|
|
376
385
|
}
|
|
377
386
|
if (argumentPointer < arguments.length) {
|
|
378
|
-
|
|
379
|
-
throw new Error(msg2)
|
|
387
|
+
const msg2 = 'Warning: pack(): ' + (arguments.length - argumentPointer) + ' arguments unused'
|
|
388
|
+
throw new Error(msg2)
|
|
380
389
|
}
|
|
381
390
|
|
|
382
|
-
return result
|
|
383
|
-
}
|
|
384
|
-
//# sourceMappingURL=pack.js.map
|
|
391
|
+
return result
|
|
392
|
+
}
|
package/php/misc/uniqid.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
module.exports = function uniqid(prefix, moreEntropy) {
|
|
4
2
|
// discuss at: https://locutus.io/php/uniqid/
|
|
5
3
|
// original by: Kevin van Zonneveld (https://kvz.io)
|
|
@@ -16,44 +14,43 @@ module.exports = function uniqid(prefix, moreEntropy) {
|
|
|
16
14
|
// returns 3: true
|
|
17
15
|
|
|
18
16
|
if (typeof prefix === 'undefined') {
|
|
19
|
-
prefix = ''
|
|
17
|
+
prefix = ''
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
seed = parseInt(seed, 10).toString(16)
|
|
20
|
+
let retId
|
|
21
|
+
const _formatSeed = function (seed, reqWidth) {
|
|
22
|
+
seed = parseInt(seed, 10).toString(16) // to hex str
|
|
25
23
|
if (reqWidth < seed.length) {
|
|
26
24
|
// so long we split
|
|
27
|
-
return seed.slice(seed.length - reqWidth)
|
|
25
|
+
return seed.slice(seed.length - reqWidth)
|
|
28
26
|
}
|
|
29
27
|
if (reqWidth > seed.length) {
|
|
30
28
|
// so short we pad
|
|
31
|
-
return Array(1 + (reqWidth - seed.length)).join('0') + seed
|
|
29
|
+
return new Array(1 + (reqWidth - seed.length)).join('0') + seed
|
|
32
30
|
}
|
|
33
|
-
return seed
|
|
34
|
-
}
|
|
31
|
+
return seed
|
|
32
|
+
}
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
$global.$locutus = $global.$locutus || {}
|
|
38
|
-
|
|
39
|
-
$locutus.php = $locutus.php || {}
|
|
34
|
+
const $global = typeof window !== 'undefined' ? window : global
|
|
35
|
+
$global.$locutus = $global.$locutus || {}
|
|
36
|
+
const $locutus = $global.$locutus
|
|
37
|
+
$locutus.php = $locutus.php || {}
|
|
40
38
|
|
|
41
39
|
if (!$locutus.php.uniqidSeed) {
|
|
42
40
|
// init seed with big random int
|
|
43
|
-
$locutus.php.uniqidSeed = Math.floor(Math.random() * 0x75bcd15)
|
|
41
|
+
$locutus.php.uniqidSeed = Math.floor(Math.random() * 0x75bcd15)
|
|
44
42
|
}
|
|
45
|
-
$locutus.php.uniqidSeed
|
|
43
|
+
$locutus.php.uniqidSeed++
|
|
46
44
|
|
|
47
45
|
// start with prefix, add current milliseconds hex string
|
|
48
|
-
retId = prefix
|
|
49
|
-
retId += _formatSeed(parseInt(new Date().getTime() / 1000, 10), 8)
|
|
46
|
+
retId = prefix
|
|
47
|
+
retId += _formatSeed(parseInt(new Date().getTime() / 1000, 10), 8)
|
|
50
48
|
// add seed hex string
|
|
51
|
-
retId += _formatSeed($locutus.php.uniqidSeed, 5)
|
|
49
|
+
retId += _formatSeed($locutus.php.uniqidSeed, 5)
|
|
52
50
|
if (moreEntropy) {
|
|
53
51
|
// for more entropy we add a float lower to 10
|
|
54
|
-
retId += (Math.random() * 10).toFixed(8).toString()
|
|
52
|
+
retId += (Math.random() * 10).toFixed(8).toString()
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
return retId
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=uniqid.js.map
|
|
55
|
+
return retId
|
|
56
|
+
}
|