locutus 2.0.32 → 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 +18 -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 +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
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
module.exports = function money_format(format, number) {
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
2
|
+
// discuss at: https://locutus.io/php/money_format/
|
|
3
|
+
// parity verified: PHP 8.3
|
|
4
|
+
// original by: Brett Zamir (https://brett-zamir.me)
|
|
5
|
+
// input by: daniel airton wermann (https://wermann.com.br)
|
|
6
|
+
// bugfixed by: Brett Zamir (https://brett-zamir.me)
|
|
7
|
+
// note 1: This depends on setlocale having the appropriate
|
|
8
|
+
// note 1: locale (these examples use 'en_US')
|
|
9
|
+
// example 1: money_format('%i', 1234.56)
|
|
10
|
+
// returns 1: ' USD 1,234.56'
|
|
11
|
+
// example 2: money_format('%14#8.2n', 1234.5678)
|
|
12
|
+
// returns 2: ' $ 1,234.57'
|
|
13
|
+
// example 3: money_format('%14#8.2n', -1234.5678)
|
|
14
|
+
// returns 3: '-$ 1,234.57'
|
|
15
|
+
// example 4: money_format('%(14#8.2n', 1234.5678)
|
|
16
|
+
// returns 4: ' $ 1,234.57 '
|
|
17
|
+
// example 5: money_format('%(14#8.2n', -1234.5678)
|
|
18
|
+
// returns 5: '($ 1,234.57)'
|
|
19
|
+
// example 6: money_format('%=014#8.2n', 1234.5678)
|
|
20
|
+
// returns 6: ' $000001,234.57'
|
|
21
|
+
// example 7: money_format('%=014#8.2n', -1234.5678)
|
|
22
|
+
// returns 7: '-$000001,234.57'
|
|
23
|
+
// example 8: money_format('%=*14#8.2n', 1234.5678)
|
|
24
|
+
// returns 8: ' $*****1,234.57'
|
|
25
|
+
// example 9: money_format('%=*14#8.2n', -1234.5678)
|
|
26
|
+
// returns 9: '-$*****1,234.57'
|
|
27
|
+
// example 10: money_format('%=*^14#8.2n', 1234.5678)
|
|
28
|
+
// returns 10: ' $****1234.57'
|
|
29
|
+
// example 11: money_format('%=*^14#8.2n', -1234.5678)
|
|
30
|
+
// returns 11: ' -$****1234.57'
|
|
31
|
+
// example 12: money_format('%=*!14#8.2n', 1234.5678)
|
|
32
|
+
// returns 12: ' *****1,234.57'
|
|
33
|
+
// example 13: money_format('%=*!14#8.2n', -1234.5678)
|
|
34
|
+
// returns 13: '-*****1,234.57'
|
|
35
|
+
// example 14: money_format('%i', 3590)
|
|
36
|
+
// returns 14: ' USD 3,590.00'
|
|
37
|
+
|
|
38
|
+
const setlocale = require('../strings/setlocale')
|
|
40
39
|
|
|
41
40
|
// Per PHP behavior, there seems to be no extra padding
|
|
42
41
|
// for sign when there is a positive number, though my
|
|
@@ -47,88 +46,90 @@ module.exports = function money_format(format, number) {
|
|
|
47
46
|
// and https://publib.boulder.ibm.com/infocenter/zos/v1r10/index.jsp?topic=/com.ibm.zos.r10.bpxbd00/strfmp.htm
|
|
48
47
|
|
|
49
48
|
if (typeof number !== 'number') {
|
|
50
|
-
return null
|
|
49
|
+
return null
|
|
51
50
|
}
|
|
52
51
|
// 1: flags, 3: width, 5: left, 7: right, 8: conversion
|
|
53
|
-
|
|
52
|
+
const regex = /%((=.|[+^(!-])*?)(\d*?)(#(\d+))?(\.(\d+))?([in%])/g
|
|
54
53
|
|
|
55
54
|
// Ensure the locale data we need is set up
|
|
56
|
-
setlocale('LC_ALL', 0)
|
|
55
|
+
setlocale('LC_ALL', 0)
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
$global.$locutus = $global.$locutus || {}
|
|
60
|
-
|
|
61
|
-
$locutus.php = $locutus.php || {}
|
|
57
|
+
const $global = typeof window !== 'undefined' ? window : global
|
|
58
|
+
$global.$locutus = $global.$locutus || {}
|
|
59
|
+
const $locutus = $global.$locutus
|
|
60
|
+
$locutus.php = $locutus.php || {}
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
const monetary = $locutus.php.locales[$locutus.php.localeCategories.LC_MONETARY].LC_MONETARY
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
const doReplace = function (n0, flags, n2, width, n4, left, n6, right, conversion) {
|
|
65
|
+
let value = ''
|
|
66
|
+
let repl = ''
|
|
68
67
|
if (conversion === '%') {
|
|
69
68
|
// Percent does not seem to be allowed with intervening content
|
|
70
|
-
return '%'
|
|
69
|
+
return '%'
|
|
71
70
|
}
|
|
72
|
-
|
|
71
|
+
const fill = flags && /=./.test(flags) ? flags.match(/=(.)/)[1] : ' ' // flag: =f (numeric fill)
|
|
73
72
|
// flag: ! (suppress currency symbol)
|
|
74
|
-
|
|
73
|
+
const showCurrSymbol = !flags || flags.indexOf('!') === -1
|
|
75
74
|
// field width: w (minimum field width)
|
|
76
|
-
width = parseInt(width, 10) || 0
|
|
75
|
+
width = parseInt(width, 10) || 0
|
|
77
76
|
|
|
78
|
-
|
|
77
|
+
const neg = number < 0
|
|
79
78
|
// Convert to string
|
|
80
|
-
number = number + ''
|
|
79
|
+
number = number + ''
|
|
81
80
|
// We don't want negative symbol represented here yet
|
|
82
|
-
number = neg ? number.slice(1) : number
|
|
81
|
+
number = neg ? number.slice(1) : number
|
|
83
82
|
|
|
84
|
-
|
|
83
|
+
const decpos = number.indexOf('.')
|
|
85
84
|
// Get integer portion
|
|
86
|
-
|
|
85
|
+
let integer = decpos !== -1 ? number.slice(0, decpos) : number
|
|
87
86
|
// Get decimal portion
|
|
88
|
-
|
|
87
|
+
let fraction = decpos !== -1 ? number.slice(decpos + 1) : ''
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
integerArr.splice(idx, 0, thouSep)
|
|
93
|
-
return integerArr.join('')
|
|
94
|
-
}
|
|
89
|
+
const _strSplice = function (integerStr, idx, thouSep) {
|
|
90
|
+
const integerArr = integerStr.split('')
|
|
91
|
+
integerArr.splice(idx, 0, thouSep)
|
|
92
|
+
return integerArr.join('')
|
|
93
|
+
}
|
|
95
94
|
|
|
96
|
-
|
|
97
|
-
left = parseInt(left, 10)
|
|
98
|
-
|
|
95
|
+
const intLen = integer.length
|
|
96
|
+
left = parseInt(left, 10)
|
|
97
|
+
const filler = intLen < left
|
|
98
|
+
const fillnum = filler ? left - intLen : 0
|
|
99
99
|
if (filler) {
|
|
100
|
-
|
|
101
|
-
integer = new Array(fillnum + 1).join(fill) + integer;
|
|
100
|
+
integer = new Array(fillnum + 1).join(fill) + integer
|
|
102
101
|
}
|
|
103
102
|
if (flags.indexOf('^') === -1) {
|
|
104
103
|
// flag: ^ (disable grouping characters (of locale))
|
|
105
104
|
// use grouping characters
|
|
106
105
|
// ','
|
|
107
|
-
|
|
106
|
+
let thouSep = monetary.mon_thousands_sep
|
|
108
107
|
// [3] (every 3 digits in U.S.A. locale)
|
|
109
|
-
|
|
108
|
+
const monGrouping = monetary.mon_grouping
|
|
110
109
|
|
|
110
|
+
let i = 0
|
|
111
|
+
let idx = integer.length
|
|
111
112
|
if (monGrouping[0] < integer.length) {
|
|
112
|
-
for (
|
|
113
|
+
for (; i < monGrouping.length; i++) {
|
|
113
114
|
// e.g., 3
|
|
114
|
-
idx -= monGrouping[i]
|
|
115
|
+
idx -= monGrouping[i]
|
|
115
116
|
if (idx <= 0) {
|
|
116
|
-
break
|
|
117
|
+
break
|
|
117
118
|
}
|
|
118
119
|
if (filler && idx < fillnum) {
|
|
119
|
-
thouSep = fill
|
|
120
|
+
thouSep = fill
|
|
120
121
|
}
|
|
121
|
-
integer = _strSplice(integer, idx, thouSep)
|
|
122
|
+
integer = _strSplice(integer, idx, thouSep)
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
if (monGrouping[i - 1] > 0) {
|
|
125
126
|
// Repeating last grouping (may only be one) until highest portion of integer reached
|
|
126
127
|
while (idx > monGrouping[i - 1]) {
|
|
127
|
-
idx -= monGrouping[i - 1]
|
|
128
|
+
idx -= monGrouping[i - 1]
|
|
128
129
|
if (filler && idx < fillnum) {
|
|
129
|
-
thouSep = fill
|
|
130
|
+
thouSep = fill
|
|
130
131
|
}
|
|
131
|
-
integer = _strSplice(integer, idx, thouSep)
|
|
132
|
+
integer = _strSplice(integer, idx, thouSep)
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
}
|
|
@@ -136,45 +137,45 @@ module.exports = function money_format(format, number) {
|
|
|
136
137
|
// left, right
|
|
137
138
|
if (right === '0') {
|
|
138
139
|
// No decimal or fractional digits
|
|
139
|
-
value = integer
|
|
140
|
+
value = integer
|
|
140
141
|
} else {
|
|
141
142
|
// '.'
|
|
142
|
-
|
|
143
|
+
let decPt = monetary.mon_decimal_point
|
|
143
144
|
if (right === '' || right === undefined) {
|
|
144
|
-
right = conversion === 'i' ? monetary.int_frac_digits : monetary.frac_digits
|
|
145
|
+
right = conversion === 'i' ? monetary.int_frac_digits : monetary.frac_digits
|
|
145
146
|
}
|
|
146
|
-
right = parseInt(right, 10)
|
|
147
|
+
right = parseInt(right, 10)
|
|
147
148
|
|
|
148
149
|
if (right === 0) {
|
|
149
150
|
// Only remove fractional portion if explicitly set to zero digits
|
|
150
|
-
fraction = ''
|
|
151
|
-
decPt = ''
|
|
151
|
+
fraction = ''
|
|
152
|
+
decPt = ''
|
|
152
153
|
} else if (right < fraction.length) {
|
|
153
|
-
fraction = Math.round(parseFloat(fraction.slice(0, right) + '.' + fraction.substr(right, 1)))
|
|
154
|
+
fraction = Math.round(parseFloat(fraction.slice(0, right) + '.' + fraction.substr(right, 1)))
|
|
154
155
|
if (right > fraction.length) {
|
|
155
|
-
fraction = new Array(right - fraction.length + 1).join('0') + fraction
|
|
156
|
+
fraction = new Array(right - fraction.length + 1).join('0') + fraction // prepend with 0's
|
|
156
157
|
}
|
|
157
158
|
} else if (right > fraction.length) {
|
|
158
|
-
fraction += new Array(right - fraction.length + 1).join('0')
|
|
159
|
+
fraction += new Array(right - fraction.length + 1).join('0') // pad with 0's
|
|
159
160
|
}
|
|
160
|
-
value = integer + decPt + fraction
|
|
161
|
+
value = integer + decPt + fraction
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
|
|
164
|
+
let symbol = ''
|
|
164
165
|
if (showCurrSymbol) {
|
|
165
166
|
// 'i' vs. 'n' ('USD' vs. '$')
|
|
166
|
-
symbol = conversion === 'i' ? monetary.int_curr_symbol : monetary.currency_symbol
|
|
167
|
+
symbol = conversion === 'i' ? monetary.int_curr_symbol : monetary.currency_symbol
|
|
167
168
|
}
|
|
168
|
-
|
|
169
|
+
const signPosn = neg ? monetary.n_sign_posn : monetary.p_sign_posn
|
|
169
170
|
|
|
170
171
|
// 0: no space between curr. symbol and value
|
|
171
172
|
// 1: space sep. them unless symb. and sign are adjacent then space sep. them from value
|
|
172
173
|
// 2: space sep. sign and value unless symb. and sign are adjacent then space separates
|
|
173
|
-
|
|
174
|
+
const sepBySpace = neg ? monetary.n_sep_by_space : monetary.p_sep_by_space
|
|
174
175
|
|
|
175
176
|
// p_cs_precedes, n_cs_precedes
|
|
176
177
|
// positive currency symbol follows value = 0; precedes value = 1
|
|
177
|
-
|
|
178
|
+
const csPrecedes = neg ? monetary.n_cs_precedes : monetary.p_cs_precedes
|
|
178
179
|
|
|
179
180
|
// Assemble symbol/value/sign and possible space as appropriate
|
|
180
181
|
if (flags.indexOf('(') !== -1) {
|
|
@@ -182,27 +183,30 @@ module.exports = function money_format(format, number) {
|
|
|
182
183
|
// @todo: unclear on whether and how sepBySpace, signPosn, or csPrecedes have
|
|
183
184
|
// an impact here (as they do below), but assuming for now behaves as signPosn 0 as
|
|
184
185
|
// far as localized sepBySpace and signPosn behavior
|
|
185
|
-
repl =
|
|
186
|
+
repl =
|
|
187
|
+
(csPrecedes ? symbol + (sepBySpace === 1 ? ' ' : '') : '') +
|
|
188
|
+
value +
|
|
189
|
+
(!csPrecedes ? (sepBySpace === 1 ? ' ' : '') + symbol : '')
|
|
186
190
|
if (neg) {
|
|
187
|
-
repl = '(' + repl + ')'
|
|
191
|
+
repl = '(' + repl + ')'
|
|
188
192
|
} else {
|
|
189
|
-
repl = ' ' + repl + ' '
|
|
193
|
+
repl = ' ' + repl + ' '
|
|
190
194
|
}
|
|
191
195
|
} else {
|
|
192
196
|
// '+' is default
|
|
193
197
|
// ''
|
|
194
|
-
|
|
198
|
+
const posSign = monetary.positive_sign
|
|
195
199
|
// '-'
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
+
const negSign = monetary.negative_sign
|
|
201
|
+
const sign = neg ? negSign : posSign
|
|
202
|
+
const otherSign = neg ? posSign : negSign
|
|
203
|
+
let signPadding = ''
|
|
200
204
|
if (signPosn) {
|
|
201
205
|
// has a sign
|
|
202
|
-
signPadding = new Array(otherSign.length - sign.length + 1).join(' ')
|
|
206
|
+
signPadding = new Array(otherSign.length - sign.length + 1).join(' ')
|
|
203
207
|
}
|
|
204
208
|
|
|
205
|
-
|
|
209
|
+
let valueAndCS = ''
|
|
206
210
|
switch (signPosn) {
|
|
207
211
|
// 0: parentheses surround value and curr. symbol;
|
|
208
212
|
// 1: sign precedes them;
|
|
@@ -210,42 +214,51 @@ module.exports = function money_format(format, number) {
|
|
|
210
214
|
// 3: sign immed. precedes curr. symbol; (but may be space between)
|
|
211
215
|
// 4: sign immed. succeeds curr. symbol; (but may be space between)
|
|
212
216
|
case 0:
|
|
213
|
-
valueAndCS = csPrecedes
|
|
214
|
-
|
|
215
|
-
|
|
217
|
+
valueAndCS = csPrecedes
|
|
218
|
+
? symbol + (sepBySpace === 1 ? ' ' : '') + value
|
|
219
|
+
: value + (sepBySpace === 1 ? ' ' : '') + symbol
|
|
220
|
+
repl = '(' + valueAndCS + ')'
|
|
221
|
+
break
|
|
216
222
|
case 1:
|
|
217
|
-
valueAndCS = csPrecedes
|
|
218
|
-
|
|
219
|
-
|
|
223
|
+
valueAndCS = csPrecedes
|
|
224
|
+
? symbol + (sepBySpace === 1 ? ' ' : '') + value
|
|
225
|
+
: value + (sepBySpace === 1 ? ' ' : '') + symbol
|
|
226
|
+
repl = signPadding + sign + (sepBySpace === 2 ? ' ' : '') + valueAndCS
|
|
227
|
+
break
|
|
220
228
|
case 2:
|
|
221
|
-
valueAndCS = csPrecedes
|
|
222
|
-
|
|
223
|
-
|
|
229
|
+
valueAndCS = csPrecedes
|
|
230
|
+
? symbol + (sepBySpace === 1 ? ' ' : '') + value
|
|
231
|
+
: value + (sepBySpace === 1 ? ' ' : '') + symbol
|
|
232
|
+
repl = valueAndCS + (sepBySpace === 2 ? ' ' : '') + sign + signPadding
|
|
233
|
+
break
|
|
224
234
|
case 3:
|
|
225
|
-
repl = csPrecedes
|
|
226
|
-
|
|
235
|
+
repl = csPrecedes
|
|
236
|
+
? signPadding + sign + (sepBySpace === 2 ? ' ' : '') + symbol + (sepBySpace === 1 ? ' ' : '') + value
|
|
237
|
+
: value + (sepBySpace === 1 ? ' ' : '') + sign + signPadding + (sepBySpace === 2 ? ' ' : '') + symbol
|
|
238
|
+
break
|
|
227
239
|
case 4:
|
|
228
|
-
repl = csPrecedes
|
|
229
|
-
|
|
240
|
+
repl = csPrecedes
|
|
241
|
+
? symbol + (sepBySpace === 2 ? ' ' : '') + signPadding + sign + (sepBySpace === 1 ? ' ' : '') + value
|
|
242
|
+
: value + (sepBySpace === 1 ? ' ' : '') + symbol + (sepBySpace === 2 ? ' ' : '') + sign + signPadding
|
|
243
|
+
break
|
|
230
244
|
}
|
|
231
245
|
}
|
|
232
246
|
|
|
233
|
-
|
|
247
|
+
let padding = width - repl.length
|
|
234
248
|
if (padding > 0) {
|
|
235
|
-
padding = new Array(padding + 1).join(' ')
|
|
249
|
+
padding = new Array(padding + 1).join(' ')
|
|
236
250
|
// @todo: How does p_sep_by_space affect the count if there is a space?
|
|
237
251
|
// Included in count presumably?
|
|
238
252
|
if (flags.indexOf('-') !== -1) {
|
|
239
253
|
// left-justified (pad to right)
|
|
240
|
-
repl += padding
|
|
254
|
+
repl += padding
|
|
241
255
|
} else {
|
|
242
256
|
// right-justified (pad to left)
|
|
243
|
-
repl = padding + repl
|
|
257
|
+
repl = padding + repl
|
|
244
258
|
}
|
|
245
259
|
}
|
|
246
|
-
return repl
|
|
247
|
-
}
|
|
260
|
+
return repl
|
|
261
|
+
}
|
|
248
262
|
|
|
249
|
-
return format.replace(regex, doReplace)
|
|
250
|
-
}
|
|
251
|
-
//# sourceMappingURL=money_format.js.map
|
|
263
|
+
return format.replace(regex, doReplace)
|
|
264
|
+
}
|
package/php/strings/nl2br.js
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
module.exports = function nl2br(str, isXhtml) {
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
2
|
+
// discuss at: https://locutus.io/php/nl2br/
|
|
3
|
+
// parity verified: PHP 8.3
|
|
4
|
+
// original by: Kevin van Zonneveld (https://kvz.io)
|
|
5
|
+
// improved by: Philip Peterson
|
|
6
|
+
// improved by: Onno Marsman (https://twitter.com/onnomarsman)
|
|
7
|
+
// improved by: Atli Þór
|
|
8
|
+
// improved by: Brett Zamir (https://brett-zamir.me)
|
|
9
|
+
// improved by: Maximusya
|
|
10
|
+
// bugfixed by: Onno Marsman (https://twitter.com/onnomarsman)
|
|
11
|
+
// bugfixed by: Kevin van Zonneveld (https://kvz.io)
|
|
12
|
+
// bugfixed by: Reynier de la Rosa (https://scriptinside.blogspot.com.es/)
|
|
13
|
+
// input by: Brett Zamir (https://brett-zamir.me)
|
|
14
|
+
// example 1: nl2br("Kevin\nvan\nZonneveld")
|
|
15
|
+
// returns 1: "Kevin<br />\nvan<br />\nZonneveld"
|
|
16
|
+
// example 2: nl2br("\nOne\nTwo\n\nThree\n", false)
|
|
17
|
+
// returns 2: "<br>\nOne<br>\nTwo<br>\n<br>\nThree<br>\n"
|
|
18
|
+
// example 3: nl2br("\nOne\nTwo\n\nThree\n", true)
|
|
19
|
+
// returns 3: "<br />\nOne<br />\nTwo<br />\n<br />\nThree<br />\n"
|
|
20
|
+
// example 4: nl2br(null)
|
|
21
|
+
// returns 4: ''
|
|
23
22
|
|
|
24
23
|
// Some latest browsers when str is null return and unexpected null value
|
|
25
24
|
if (typeof str === 'undefined' || str === null) {
|
|
26
|
-
return ''
|
|
25
|
+
return ''
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
// Adjust comment to avoid issue on locutus.io display
|
|
30
|
-
|
|
29
|
+
const breakTag = isXhtml || typeof isXhtml === 'undefined' ? '<br ' + '/>' : '<br>'
|
|
31
30
|
|
|
32
|
-
return (str + '').replace(/(\r\n|\n\r|\r|\n)/g, breakTag + '$1')
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=nl2br.js.map
|
|
31
|
+
return (str + '').replace(/(\r\n|\n\r|\r|\n)/g, breakTag + '$1')
|
|
32
|
+
}
|
|
@@ -1,56 +1,54 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
module.exports = function nl_langinfo(item) {
|
|
4
2
|
// discuss at: https://locutus.io/php/nl_langinfo/
|
|
5
3
|
// original by: Brett Zamir (https://brett-zamir.me)
|
|
6
4
|
// example 1: nl_langinfo('DAY_1')
|
|
7
5
|
// returns 1: 'Sunday'
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
const setlocale = require('../strings/setlocale')
|
|
10
8
|
|
|
11
|
-
setlocale('LC_ALL', 0)
|
|
9
|
+
setlocale('LC_ALL', 0) // Ensure locale data is available
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
$global.$locutus = $global.$locutus || {}
|
|
15
|
-
|
|
16
|
-
$locutus.php = $locutus.php || {}
|
|
11
|
+
const $global = typeof window !== 'undefined' ? window : global
|
|
12
|
+
$global.$locutus = $global.$locutus || {}
|
|
13
|
+
const $locutus = $global.$locutus
|
|
14
|
+
$locutus.php = $locutus.php || {}
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
let loc = $locutus.php.locales[$locutus.php.localeCategories.LC_TIME]
|
|
19
17
|
if (item.indexOf('ABDAY_') === 0) {
|
|
20
|
-
return loc.LC_TIME.a[parseInt(item.replace(/^ABDAY_/, ''), 10) - 1]
|
|
18
|
+
return loc.LC_TIME.a[parseInt(item.replace(/^ABDAY_/, ''), 10) - 1]
|
|
21
19
|
} else if (item.indexOf('DAY_') === 0) {
|
|
22
|
-
return loc.LC_TIME.A[parseInt(item.replace(/^DAY_/, ''), 10) - 1]
|
|
20
|
+
return loc.LC_TIME.A[parseInt(item.replace(/^DAY_/, ''), 10) - 1]
|
|
23
21
|
} else if (item.indexOf('ABMON_') === 0) {
|
|
24
|
-
return loc.LC_TIME.b[parseInt(item.replace(/^ABMON_/, ''), 10) - 1]
|
|
22
|
+
return loc.LC_TIME.b[parseInt(item.replace(/^ABMON_/, ''), 10) - 1]
|
|
25
23
|
} else if (item.indexOf('MON_') === 0) {
|
|
26
|
-
return loc.LC_TIME.B[parseInt(item.replace(/^MON_/, ''), 10) - 1]
|
|
24
|
+
return loc.LC_TIME.B[parseInt(item.replace(/^MON_/, ''), 10) - 1]
|
|
27
25
|
} else {
|
|
28
26
|
switch (item) {
|
|
29
27
|
// More LC_TIME
|
|
30
28
|
case 'AM_STR':
|
|
31
|
-
return loc.LC_TIME.p[0]
|
|
29
|
+
return loc.LC_TIME.p[0]
|
|
32
30
|
case 'PM_STR':
|
|
33
|
-
return loc.LC_TIME.p[1]
|
|
31
|
+
return loc.LC_TIME.p[1]
|
|
34
32
|
case 'D_T_FMT':
|
|
35
|
-
return loc.LC_TIME.c
|
|
33
|
+
return loc.LC_TIME.c
|
|
36
34
|
case 'D_FMT':
|
|
37
|
-
return loc.LC_TIME.x
|
|
35
|
+
return loc.LC_TIME.x
|
|
38
36
|
case 'T_FMT':
|
|
39
|
-
return loc.LC_TIME.X
|
|
37
|
+
return loc.LC_TIME.X
|
|
40
38
|
case 'T_FMT_AMPM':
|
|
41
|
-
return loc.LC_TIME.r
|
|
39
|
+
return loc.LC_TIME.r
|
|
42
40
|
case 'ERA':
|
|
43
41
|
case 'ERA_YEAR':
|
|
44
42
|
case 'ERA_D_T_FMT':
|
|
45
43
|
case 'ERA_D_FMT':
|
|
46
44
|
case 'ERA_T_FMT':
|
|
47
45
|
// all fall-throughs
|
|
48
|
-
return loc.LC_TIME[item]
|
|
46
|
+
return loc.LC_TIME[item]
|
|
49
47
|
}
|
|
50
|
-
loc = $locutus.php.locales[$locutus.php.localeCategories.LC_MONETARY]
|
|
48
|
+
loc = $locutus.php.locales[$locutus.php.localeCategories.LC_MONETARY]
|
|
51
49
|
if (item === 'CRNCYSTR') {
|
|
52
50
|
// alias
|
|
53
|
-
item = 'CURRENCY_SYMBOL'
|
|
51
|
+
item = 'CURRENCY_SYMBOL'
|
|
54
52
|
}
|
|
55
53
|
switch (item) {
|
|
56
54
|
case 'INT_CURR_SYMBOL':
|
|
@@ -68,40 +66,39 @@ module.exports = function nl_langinfo(item) {
|
|
|
68
66
|
case 'P_SIGN_POSN':
|
|
69
67
|
case 'N_SIGN_POSN':
|
|
70
68
|
// all fall-throughs
|
|
71
|
-
return loc.LC_MONETARY[item.toLowerCase()]
|
|
69
|
+
return loc.LC_MONETARY[item.toLowerCase()]
|
|
72
70
|
case 'MON_GROUPING':
|
|
73
71
|
// Same as above, or return something different since this returns an array?
|
|
74
|
-
return loc.LC_MONETARY[item.toLowerCase()]
|
|
72
|
+
return loc.LC_MONETARY[item.toLowerCase()]
|
|
75
73
|
}
|
|
76
|
-
loc = $locutus.php.locales[$locutus.php.localeCategories.LC_NUMERIC]
|
|
74
|
+
loc = $locutus.php.locales[$locutus.php.localeCategories.LC_NUMERIC]
|
|
77
75
|
switch (item) {
|
|
78
76
|
case 'RADIXCHAR':
|
|
79
77
|
case 'DECIMAL_POINT':
|
|
80
78
|
// Fall-through
|
|
81
|
-
return loc.LC_NUMERIC[item.toLowerCase()]
|
|
79
|
+
return loc.LC_NUMERIC[item.toLowerCase()]
|
|
82
80
|
case 'THOUSEP':
|
|
83
81
|
case 'THOUSANDS_SEP':
|
|
84
82
|
// Fall-through
|
|
85
|
-
return loc.LC_NUMERIC[item.toLowerCase()]
|
|
83
|
+
return loc.LC_NUMERIC[item.toLowerCase()]
|
|
86
84
|
case 'GROUPING':
|
|
87
85
|
// Same as above, or return something different since this returns an array?
|
|
88
|
-
return loc.LC_NUMERIC[item.toLowerCase()]
|
|
86
|
+
return loc.LC_NUMERIC[item.toLowerCase()]
|
|
89
87
|
}
|
|
90
|
-
loc = $locutus.php.locales[$locutus.php.localeCategories.LC_MESSAGES]
|
|
88
|
+
loc = $locutus.php.locales[$locutus.php.localeCategories.LC_MESSAGES]
|
|
91
89
|
switch (item) {
|
|
92
90
|
case 'YESEXPR':
|
|
93
91
|
case 'NOEXPR':
|
|
94
92
|
case 'YESSTR':
|
|
95
93
|
case 'NOSTR':
|
|
96
94
|
// all fall-throughs
|
|
97
|
-
return loc.LC_MESSAGES[item]
|
|
95
|
+
return loc.LC_MESSAGES[item]
|
|
98
96
|
}
|
|
99
|
-
loc = $locutus.php.locales[$locutus.php.localeCategories.LC_CTYPE]
|
|
97
|
+
loc = $locutus.php.locales[$locutus.php.localeCategories.LC_CTYPE]
|
|
100
98
|
if (item === 'CODESET') {
|
|
101
|
-
return loc.LC_CTYPE[item]
|
|
99
|
+
return loc.LC_CTYPE[item]
|
|
102
100
|
}
|
|
103
101
|
|
|
104
|
-
return false
|
|
102
|
+
return false
|
|
105
103
|
}
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=nl_langinfo.js.map
|
|
104
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
module.exports = function number_format(number, decimals, decPoint, thousandsSep) {
|
|
4
2
|
// discuss at: https://locutus.io/php/number_format/
|
|
5
3
|
// original by: Jonas Raoni Soares Silva (https://www.jsfromhell.com)
|
|
@@ -51,36 +49,35 @@ module.exports = function number_format(number, decimals, decPoint, thousandsSep
|
|
|
51
49
|
// example 14: number_format(1e-8, 8, '.', '')
|
|
52
50
|
// returns 14: '0.00000001'
|
|
53
51
|
|
|
54
|
-
number = (number + '').replace(/[^0-9+\-Ee.]/g, '')
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
number = (number + '').replace(/[^0-9+\-Ee.]/g, '')
|
|
53
|
+
const n = !isFinite(+number) ? 0 : +number
|
|
54
|
+
const prec = !isFinite(+decimals) ? 0 : Math.abs(decimals)
|
|
55
|
+
const sep = typeof thousandsSep === 'undefined' ? ',' : thousandsSep
|
|
56
|
+
const dec = typeof decPoint === 'undefined' ? '.' : decPoint
|
|
57
|
+
let s = ''
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
const toFixedFix = function (n, prec) {
|
|
62
60
|
if (('' + n).indexOf('e') === -1) {
|
|
63
|
-
return +(Math.round(n + 'e+' + prec) + 'e-' + prec)
|
|
61
|
+
return +(Math.round(n + 'e+' + prec) + 'e-' + prec)
|
|
64
62
|
} else {
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
const arr = ('' + n).split('e')
|
|
64
|
+
let sig = ''
|
|
67
65
|
if (+arr[1] + prec > 0) {
|
|
68
|
-
sig = '+'
|
|
66
|
+
sig = '+'
|
|
69
67
|
}
|
|
70
|
-
return (+(Math.round(+arr[0] + 'e' + sig + (+arr[1] + prec)) + 'e-' + prec)).toFixed(prec)
|
|
68
|
+
return (+(Math.round(+arr[0] + 'e' + sig + (+arr[1] + prec)) + 'e-' + prec)).toFixed(prec)
|
|
71
69
|
}
|
|
72
|
-
}
|
|
70
|
+
}
|
|
73
71
|
|
|
74
72
|
// @todo: for IE parseFloat(0.55).toFixed(0) = 0;
|
|
75
|
-
s = (prec ? toFixedFix(n, prec).toString() : '' + Math.round(n)).split('.')
|
|
73
|
+
s = (prec ? toFixedFix(n, prec).toString() : '' + Math.round(n)).split('.')
|
|
76
74
|
if (s[0].length > 3) {
|
|
77
|
-
s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep)
|
|
75
|
+
s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep)
|
|
78
76
|
}
|
|
79
77
|
if ((s[1] || '').length < prec) {
|
|
80
|
-
s[1] = s[1] || ''
|
|
81
|
-
s[1] += new Array(prec - s[1].length + 1).join('0')
|
|
78
|
+
s[1] = s[1] || ''
|
|
79
|
+
s[1] += new Array(prec - s[1].length + 1).join('0')
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
return s.join(dec)
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=number_format.js.map
|
|
82
|
+
return s.join(dec)
|
|
83
|
+
}
|