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.
Files changed (880) hide show
  1. package/README.md +18 -0
  2. package/_data/rosetta.yml +325 -0
  3. package/awk/builtin/index.js +3 -0
  4. package/awk/builtin/int.js +13 -0
  5. package/awk/builtin/length.js +16 -0
  6. package/awk/builtin/substr.js +23 -0
  7. package/c/ctype/index.js +8 -0
  8. package/c/ctype/isalnum.js +15 -0
  9. package/c/ctype/isalpha.js +17 -0
  10. package/c/ctype/isdigit.js +15 -0
  11. package/c/ctype/islower.js +15 -0
  12. package/c/ctype/isspace.js +15 -0
  13. package/c/ctype/isupper.js +15 -0
  14. package/c/ctype/tolower.js +15 -0
  15. package/c/ctype/toupper.js +15 -0
  16. package/c/index.js +2 -5
  17. package/c/math/abs.js +14 -18
  18. package/c/math/frexp.js +19 -20
  19. package/c/math/index.js +2 -5
  20. package/c/stdio/index.js +1 -4
  21. package/c/stdio/sprintf.js +71 -81
  22. package/c/stdlib/atof.js +15 -0
  23. package/c/stdlib/atoi.js +17 -0
  24. package/c/stdlib/index.js +2 -0
  25. package/c/string/index.js +5 -0
  26. package/c/string/strcat.js +12 -0
  27. package/c/string/strchr.js +15 -0
  28. package/c/string/strcmp.js +21 -0
  29. package/c/string/strlen.js +12 -0
  30. package/c/string/strstr.js +15 -0
  31. package/clojure/Math/abs.js +13 -0
  32. package/clojure/Math/ceil.js +15 -0
  33. package/clojure/Math/floor.js +14 -0
  34. package/clojure/Math/index.js +3 -0
  35. package/elixir/Float/ceil.js +16 -0
  36. package/elixir/Float/floor.js +14 -0
  37. package/elixir/Float/index.js +2 -0
  38. package/elixir/Kernel/abs.js +13 -0
  39. package/elixir/Kernel/index.js +1 -0
  40. package/golang/index.js +1 -4
  41. package/golang/strconv/Atoi.js +26 -0
  42. package/golang/strconv/FormatBool.js +12 -0
  43. package/golang/strconv/FormatInt.js +21 -0
  44. package/golang/strconv/Itoa.js +14 -0
  45. package/golang/strconv/ParseBool.js +35 -0
  46. package/golang/strconv/ParseInt.js +27 -0
  47. package/golang/strconv/index.js +6 -0
  48. package/golang/strings/Compare.js +19 -0
  49. package/golang/strings/Contains.js +7 -9
  50. package/golang/strings/ContainsAny.js +18 -0
  51. package/golang/strings/Count.js +20 -22
  52. package/golang/strings/EqualFold.js +13 -0
  53. package/golang/strings/Fields.js +12 -0
  54. package/golang/strings/HasPrefix.js +15 -0
  55. package/golang/strings/HasSuffix.js +20 -0
  56. package/golang/strings/Index.js +11 -0
  57. package/golang/strings/Index2.js +9 -11
  58. package/golang/strings/IndexAny.js +18 -0
  59. package/golang/strings/Join.js +16 -0
  60. package/golang/strings/LastIndex.js +10 -12
  61. package/golang/strings/LastIndexAny.js +18 -0
  62. package/golang/strings/Repeat.js +19 -0
  63. package/golang/strings/Replace.js +44 -0
  64. package/golang/strings/Split.js +24 -0
  65. package/golang/strings/ToLower.js +9 -0
  66. package/golang/strings/ToUpper.js +9 -0
  67. package/golang/strings/Trim.js +19 -0
  68. package/golang/strings/TrimLeft.js +15 -0
  69. package/golang/strings/TrimPrefix.js +14 -0
  70. package/golang/strings/TrimRight.js +15 -0
  71. package/golang/strings/TrimSpace.js +10 -0
  72. package/golang/strings/TrimSuffix.js +14 -0
  73. package/golang/strings/index.js +25 -7
  74. package/index.js +5 -8
  75. package/julia/Base/abs.js +13 -0
  76. package/julia/Base/ceil.js +16 -0
  77. package/julia/Base/floor.js +14 -0
  78. package/julia/Base/index.js +3 -0
  79. package/lua/math/abs.js +13 -0
  80. package/lua/math/ceil.js +16 -0
  81. package/lua/math/floor.js +14 -0
  82. package/lua/math/index.js +3 -0
  83. package/package.json +37 -51
  84. package/perl/POSIX/ceil.js +16 -0
  85. package/perl/POSIX/floor.js +14 -0
  86. package/perl/POSIX/index.js +2 -0
  87. package/perl/core/index.js +1 -0
  88. package/perl/core/length.js +16 -0
  89. package/php/_helpers/_bc.js +524 -515
  90. package/php/_helpers/_phpCastString.js +20 -25
  91. package/php/_helpers/_php_cast_float.js +5 -10
  92. package/php/_helpers/_php_cast_int.js +6 -11
  93. package/php/_helpers/index.js +4 -7
  94. package/php/array/array_change_key_case.js +11 -16
  95. package/php/array/array_chunk.js +20 -23
  96. package/php/array/array_column.js +22 -72
  97. package/php/array/array_combine.js +13 -18
  98. package/php/array/array_count_values.js +35 -39
  99. package/php/array/array_diff.js +11 -14
  100. package/php/array/array_diff_assoc.js +11 -14
  101. package/php/array/array_diff_key.js +11 -14
  102. package/php/array/array_diff_uassoc.js +15 -19
  103. package/php/array/array_diff_ukey.js +14 -17
  104. package/php/array/array_fill.js +11 -13
  105. package/php/array/array_fill_keys.js +5 -8
  106. package/php/array/array_filter.js +12 -13
  107. package/php/array/array_flip.js +13 -15
  108. package/php/array/array_intersect.js +13 -16
  109. package/php/array/array_intersect_assoc.js +13 -16
  110. package/php/array/array_intersect_key.js +15 -18
  111. package/php/array/array_intersect_uassoc.js +17 -20
  112. package/php/array/array_intersect_ukey.js +17 -20
  113. package/php/array/array_key_exists.js +4 -7
  114. package/php/array/array_keys.js +22 -24
  115. package/php/array/array_map.js +24 -29
  116. package/php/array/array_merge.js +22 -25
  117. package/php/array/array_merge_recursive.js +51 -27
  118. package/php/array/array_multisort.js +138 -130
  119. package/php/array/array_pad.js +24 -26
  120. package/php/array/array_pop.js +10 -13
  121. package/php/array/array_product.js +15 -17
  122. package/php/array/array_push.js +16 -19
  123. package/php/array/array_rand.js +11 -14
  124. package/php/array/array_reduce.js +11 -14
  125. package/php/array/array_replace.js +9 -12
  126. package/php/array/array_replace_recursive.js +20 -24
  127. package/php/array/array_reverse.js +12 -15
  128. package/php/array/array_search.js +27 -29
  129. package/php/array/array_shift.js +3 -6
  130. package/php/array/array_slice.js +37 -39
  131. package/php/array/array_splice.js +64 -69
  132. package/php/array/array_sum.js +7 -12
  133. package/php/array/array_udiff.js +14 -17
  134. package/php/array/array_udiff_assoc.js +14 -17
  135. package/php/array/array_udiff_uassoc.js +17 -20
  136. package/php/array/array_uintersect.js +16 -19
  137. package/php/array/array_uintersect_uassoc.js +18 -21
  138. package/php/array/array_unique.js +12 -15
  139. package/php/array/array_unshift.js +4 -7
  140. package/php/array/array_values.js +11 -13
  141. package/php/array/array_walk.js +10 -15
  142. package/php/array/array_walk_recursive.js +15 -20
  143. package/php/array/arsort.js +50 -52
  144. package/php/array/asort.js +50 -51
  145. package/php/array/count.js +15 -14
  146. package/php/array/current.js +30 -32
  147. package/php/array/each.js +32 -35
  148. package/php/array/end.js +27 -30
  149. package/php/array/in_array.js +7 -10
  150. package/php/array/index.js +73 -76
  151. package/php/array/key.js +32 -34
  152. package/php/array/krsort.js +50 -51
  153. package/php/array/ksort.js +50 -51
  154. package/php/array/natcasesort.js +37 -38
  155. package/php/array/natsort.js +35 -36
  156. package/php/array/next.js +34 -36
  157. package/php/array/pos.js +10 -12
  158. package/php/array/prev.js +32 -34
  159. package/php/array/range.js +30 -33
  160. package/php/array/reset.js +24 -27
  161. package/php/array/rsort.js +47 -49
  162. package/php/array/shuffle.js +16 -18
  163. package/php/array/sizeof.js +3 -6
  164. package/php/array/sort.js +43 -45
  165. package/php/array/uasort.js +19 -21
  166. package/php/array/uksort.js +22 -24
  167. package/php/array/usort.js +20 -22
  168. package/php/bc/bcadd.js +16 -19
  169. package/php/bc/bccomp.js +12 -15
  170. package/php/bc/bcdiv.js +17 -20
  171. package/php/bc/bcmul.js +16 -19
  172. package/php/bc/bcround.js +21 -24
  173. package/php/bc/bcscale.js +8 -11
  174. package/php/bc/bcsub.js +16 -19
  175. package/php/bc/index.js +7 -10
  176. package/php/ctype/ctype_alnum.js +14 -16
  177. package/php/ctype/ctype_alpha.js +14 -16
  178. package/php/ctype/ctype_cntrl.js +9 -12
  179. package/php/ctype/ctype_digit.js +14 -16
  180. package/php/ctype/ctype_graph.js +14 -16
  181. package/php/ctype/ctype_lower.js +14 -16
  182. package/php/ctype/ctype_print.js +14 -16
  183. package/php/ctype/ctype_punct.js +14 -16
  184. package/php/ctype/ctype_space.js +9 -12
  185. package/php/ctype/ctype_upper.js +14 -16
  186. package/php/ctype/ctype_xdigit.js +14 -16
  187. package/php/ctype/index.js +11 -14
  188. package/php/datetime/checkdate.js +15 -17
  189. package/php/datetime/date.js +142 -123
  190. package/php/datetime/date_parse.js +18 -21
  191. package/php/datetime/getdate.js +38 -24
  192. package/php/datetime/gettimeofday.js +7 -10
  193. package/php/datetime/gmdate.js +17 -16
  194. package/php/datetime/gmmktime.js +23 -25
  195. package/php/datetime/gmstrftime.js +17 -14
  196. package/php/datetime/idate.js +44 -38
  197. package/php/datetime/index.js +15 -18
  198. package/php/datetime/microtime.js +11 -14
  199. package/php/datetime/mktime.js +14 -17
  200. package/php/datetime/strftime.js +122 -113
  201. package/php/datetime/strptime.js +210 -191
  202. package/php/datetime/strtotime.js +615 -496
  203. package/php/datetime/time.js +11 -13
  204. package/php/exec/escapeshellarg.js +16 -18
  205. package/php/exec/index.js +1 -4
  206. package/php/filesystem/basename.js +22 -24
  207. package/php/filesystem/dirname.js +12 -14
  208. package/php/filesystem/file_exists.js +9 -11
  209. package/php/filesystem/file_get_contents.js +3 -6
  210. package/php/filesystem/index.js +6 -9
  211. package/php/filesystem/pathinfo.js +47 -46
  212. package/php/filesystem/realpath.js +16 -19
  213. package/php/funchand/call_user_func.js +4 -7
  214. package/php/funchand/call_user_func_array.js +19 -22
  215. package/php/funchand/create_function.js +4 -7
  216. package/php/funchand/function_exists.js +4 -8
  217. package/php/funchand/get_defined_functions.js +25 -32
  218. package/php/funchand/index.js +5 -8
  219. package/php/i18n/i18n_loc_get_default.js +7 -10
  220. package/php/i18n/i18n_loc_set_default.js +12 -15
  221. package/php/i18n/index.js +2 -5
  222. package/php/index.js +20 -23
  223. package/php/info/assert_options.js +25 -27
  224. package/php/info/getenv.js +8 -10
  225. package/php/info/index.js +6 -9
  226. package/php/info/ini_get.js +9 -12
  227. package/php/info/ini_set.js +32 -34
  228. package/php/info/set_time_limit.js +8 -11
  229. package/php/info/version_compare.js +43 -44
  230. package/php/json/index.js +3 -6
  231. package/php/json/json_decode.js +42 -28
  232. package/php/json/json_encode.js +89 -66
  233. package/php/json/json_last_error.js +11 -13
  234. package/php/math/abs.js +2 -5
  235. package/php/math/acos.js +2 -5
  236. package/php/math/acosh.js +7 -9
  237. package/php/math/asin.js +2 -5
  238. package/php/math/asinh.js +7 -9
  239. package/php/math/atan.js +7 -9
  240. package/php/math/atan2.js +7 -9
  241. package/php/math/atanh.js +2 -5
  242. package/php/math/base_convert.js +8 -10
  243. package/php/math/bindec.js +12 -14
  244. package/php/math/ceil.js +7 -9
  245. package/php/math/cos.js +7 -9
  246. package/php/math/cosh.js +7 -9
  247. package/php/math/decbin.js +16 -18
  248. package/php/math/dechex.js +3 -6
  249. package/php/math/decoct.js +13 -15
  250. package/php/math/deg2rad.js +8 -10
  251. package/php/math/exp.js +7 -9
  252. package/php/math/expm1.js +9 -11
  253. package/php/math/floor.js +7 -9
  254. package/php/math/fmod.js +27 -29
  255. package/php/math/getrandmax.js +7 -9
  256. package/php/math/hexdec.js +10 -12
  257. package/php/math/hypot.js +8 -11
  258. package/php/math/index.js +46 -49
  259. package/php/math/is_finite.js +9 -14
  260. package/php/math/is_infinite.js +9 -14
  261. package/php/math/is_nan.js +8 -13
  262. package/php/math/lcg_value.js +8 -10
  263. package/php/math/log.js +8 -10
  264. package/php/math/log10.js +12 -14
  265. package/php/math/log1p.js +15 -17
  266. package/php/math/max.js +54 -59
  267. package/php/math/min.js +54 -59
  268. package/php/math/mt_getrandmax.js +7 -9
  269. package/php/math/mt_rand.js +15 -17
  270. package/php/math/octdec.js +8 -10
  271. package/php/math/pi.js +2 -5
  272. package/php/math/pow.js +2 -5
  273. package/php/math/rad2deg.js +8 -10
  274. package/php/math/rand.js +15 -17
  275. package/php/math/round.js +48 -49
  276. package/php/math/sin.js +7 -9
  277. package/php/math/sinh.js +7 -9
  278. package/php/math/sqrt.js +7 -9
  279. package/php/math/tan.js +7 -9
  280. package/php/math/tanh.js +8 -10
  281. package/php/misc/index.js +2 -5
  282. package/php/misc/pack.js +173 -165
  283. package/php/misc/uniqid.js +20 -23
  284. package/php/net-gopher/gopher_parsedir.js +27 -29
  285. package/php/net-gopher/index.js +1 -4
  286. package/php/network/index.js +6 -9
  287. package/php/network/inet_ntop.js +15 -15
  288. package/php/network/inet_pton.js +30 -34
  289. package/php/network/ip2long.js +25 -15
  290. package/php/network/long2ip.js +8 -10
  291. package/php/network/setcookie.js +11 -13
  292. package/php/network/setrawcookie.js +16 -19
  293. package/php/pcre/index.js +4 -7
  294. package/php/pcre/preg_match.js +3 -6
  295. package/php/pcre/preg_quote.js +2 -5
  296. package/php/pcre/preg_replace.js +8 -11
  297. package/php/pcre/sql_regcase.js +17 -20
  298. package/php/strings/addcslashes.js +86 -88
  299. package/php/strings/addslashes.js +15 -16
  300. package/php/strings/bin2hex.js +19 -43
  301. package/php/strings/chop.js +8 -10
  302. package/php/strings/chr.js +12 -14
  303. package/php/strings/chunk_split.js +15 -17
  304. package/php/strings/convert_cyr_string.js +137 -50
  305. package/php/strings/convert_uuencode.js +35 -38
  306. package/php/strings/count_chars.js +29 -27
  307. package/php/strings/crc32.js +276 -21
  308. package/php/strings/echo.js +28 -30
  309. package/php/strings/explode.js +31 -26
  310. package/php/strings/get_html_translation_table.js +123 -122
  311. package/php/strings/hex2bin.js +21 -21
  312. package/php/strings/html_entity_decode.js +31 -33
  313. package/php/strings/htmlentities.js +38 -34
  314. package/php/strings/htmlspecialchars.js +20 -23
  315. package/php/strings/htmlspecialchars_decode.js +19 -21
  316. package/php/strings/implode.js +23 -27
  317. package/php/strings/index.js +91 -94
  318. package/php/strings/join.js +8 -10
  319. package/php/strings/lcfirst.js +9 -11
  320. package/php/strings/levenshtein.js +37 -39
  321. package/php/strings/localeconv.js +12 -15
  322. package/php/strings/ltrim.js +12 -14
  323. package/php/strings/md5.js +216 -223
  324. package/php/strings/md5_file.js +17 -19
  325. package/php/strings/metaphone.js +112 -117
  326. package/php/strings/money_format.js +139 -126
  327. package/php/strings/nl2br.js +24 -26
  328. package/php/strings/nl_langinfo.js +32 -35
  329. package/php/strings/number_format.js +19 -22
  330. package/php/strings/ord.js +19 -21
  331. package/php/strings/parse_str.js +53 -56
  332. package/php/strings/printf.js +6 -9
  333. package/php/strings/quoted_printable_decode.js +7 -10
  334. package/php/strings/quoted_printable_encode.js +19 -20
  335. package/php/strings/quotemeta.js +7 -9
  336. package/php/strings/rtrim.js +14 -16
  337. package/php/strings/setlocale.js +148 -104
  338. package/php/strings/sha1.js +108 -106
  339. package/php/strings/sha1_file.js +15 -17
  340. package/php/strings/similar_text.js +34 -33
  341. package/php/strings/soundex.js +34 -36
  342. package/php/strings/split.js +8 -10
  343. package/php/strings/sprintf.js +112 -114
  344. package/php/strings/sscanf.js +99 -96
  345. package/php/strings/str_getcsv.js +37 -32
  346. package/php/strings/str_ireplace.js +50 -55
  347. package/php/strings/str_pad.js +18 -21
  348. package/php/strings/str_repeat.js +14 -16
  349. package/php/strings/str_replace.js +32 -37
  350. package/php/strings/str_rot13.js +15 -17
  351. package/php/strings/str_shuffle.js +12 -15
  352. package/php/strings/str_split.js +19 -21
  353. package/php/strings/str_word_count.js +51 -50
  354. package/php/strings/strcasecmp.js +12 -14
  355. package/php/strings/strchr.js +10 -12
  356. package/php/strings/strcmp.js +12 -14
  357. package/php/strings/strcoll.js +9 -12
  358. package/php/strings/strcspn.js +30 -25
  359. package/php/strings/strip_tags.js +50 -52
  360. package/php/strings/stripos.js +12 -14
  361. package/php/strings/stripslashes.js +8 -10
  362. package/php/strings/stristr.js +15 -17
  363. package/php/strings/strlen.js +23 -26
  364. package/php/strings/strnatcasecmp.js +6 -8
  365. package/php/strings/strnatcmp.js +47 -46
  366. package/php/strings/strncasecmp.js +30 -32
  367. package/php/strings/strncmp.js +5 -7
  368. package/php/strings/strpbrk.js +12 -14
  369. package/php/strings/strpos.js +11 -13
  370. package/php/strings/strrchr.js +7 -10
  371. package/php/strings/strrev.js +188 -10
  372. package/php/strings/strripos.js +16 -18
  373. package/php/strings/strrpos.js +20 -22
  374. package/php/strings/strspn.js +24 -26
  375. package/php/strings/strstr.js +20 -22
  376. package/php/strings/strtok.js +14 -16
  377. package/php/strings/strtolower.js +8 -10
  378. package/php/strings/strtoupper.js +8 -10
  379. package/php/strings/strtr.js +38 -43
  380. package/php/strings/substr.js +14 -18
  381. package/php/strings/substr_compare.js +18 -20
  382. package/php/strings/substr_count.js +11 -14
  383. package/php/strings/substr_replace.js +5 -8
  384. package/php/strings/trim.js +53 -32
  385. package/php/strings/ucfirst.js +11 -13
  386. package/php/strings/ucwords.js +3 -6
  387. package/php/strings/vprintf.js +6 -9
  388. package/php/strings/vsprintf.js +8 -10
  389. package/php/strings/wordwrap.js +32 -35
  390. package/php/url/base64_decode.js +42 -40
  391. package/php/url/base64_encode.js +51 -53
  392. package/php/url/http_build_query.js +27 -32
  393. package/php/url/index.js +8 -11
  394. package/php/url/parse_url.js +61 -25
  395. package/php/url/rawurldecode.js +8 -8
  396. package/php/url/rawurlencode.js +9 -6
  397. package/php/url/urldecode.js +9 -8
  398. package/php/url/urlencode.js +11 -6
  399. package/php/var/boolval.js +31 -33
  400. package/php/var/doubleval.js +10 -12
  401. package/php/var/empty.js +11 -16
  402. package/php/var/floatval.js +13 -15
  403. package/php/var/gettype.js +22 -23
  404. package/php/var/index.js +30 -33
  405. package/php/var/intval.js +35 -39
  406. package/php/var/is_array.js +27 -31
  407. package/php/var/is_binary.js +2 -5
  408. package/php/var/is_bool.js +10 -12
  409. package/php/var/is_buffer.js +2 -5
  410. package/php/var/is_callable.js +34 -35
  411. package/php/var/is_double.js +10 -12
  412. package/php/var/is_float.js +12 -14
  413. package/php/var/is_int.js +20 -22
  414. package/php/var/is_integer.js +12 -14
  415. package/php/var/is_long.js +3 -6
  416. package/php/var/is_null.js +9 -11
  417. package/php/var/is_numeric.js +30 -6
  418. package/php/var/is_object.js +4 -9
  419. package/php/var/is_real.js +3 -6
  420. package/php/var/is_scalar.js +2 -8
  421. package/php/var/is_string.js +9 -11
  422. package/php/var/is_unicode.js +12 -15
  423. package/php/var/isset.js +9 -12
  424. package/php/var/print_r.js +49 -53
  425. package/php/var/serialize.js +47 -52
  426. package/php/var/serialize.vitest.ts +10 -0
  427. package/php/var/strval.js +10 -13
  428. package/php/var/unserialize.js +168 -202
  429. package/php/var/var_dump.js +105 -104
  430. package/php/var/var_export.js +64 -66
  431. package/php/xdiff/index.js +2 -5
  432. package/php/xdiff/xdiff_string_diff.js +240 -226
  433. package/php/xdiff/xdiff_string_patch.js +98 -93
  434. package/php/xml/index.js +2 -5
  435. package/php/xml/utf8_decode.js +40 -42
  436. package/php/xml/utf8_encode.js +40 -42
  437. package/python/index.js +1 -4
  438. package/python/math/ceil.js +17 -0
  439. package/python/math/exp.js +12 -0
  440. package/python/math/fabs.js +14 -0
  441. package/python/math/factorial.js +29 -0
  442. package/python/math/floor.js +14 -0
  443. package/python/math/gcd.js +23 -0
  444. package/python/math/index.js +15 -0
  445. package/python/math/isfinite.js +14 -0
  446. package/python/math/isinf.js +14 -0
  447. package/python/math/isnan.js +14 -0
  448. package/python/math/log.js +16 -0
  449. package/python/math/log10.js +14 -0
  450. package/python/math/log2.js +14 -0
  451. package/python/math/pow.js +14 -0
  452. package/python/math/sqrt.js +14 -0
  453. package/python/math/trunc.js +14 -0
  454. package/python/string/ascii_letters.js +14 -14
  455. package/python/string/ascii_lowercase.js +12 -16
  456. package/python/string/ascii_uppercase.js +12 -16
  457. package/python/string/capwords.js +4 -7
  458. package/python/string/digits.js +10 -0
  459. package/python/string/hexdigits.js +10 -0
  460. package/python/string/index.js +10 -8
  461. package/python/string/octdigits.js +10 -0
  462. package/python/string/printable.js +15 -0
  463. package/python/string/punctuation.js +5 -7
  464. package/python/string/whitespace.js +10 -0
  465. package/r/base/abs.js +13 -0
  466. package/r/base/ceiling.js +16 -0
  467. package/r/base/floor.js +14 -0
  468. package/r/base/index.js +3 -0
  469. package/ruby/Array/compact.js +18 -0
  470. package/ruby/Array/first.js +22 -0
  471. package/ruby/Array/flatten.js +22 -0
  472. package/ruby/Array/index.js +6 -0
  473. package/ruby/Array/last.js +22 -0
  474. package/ruby/Array/sample.js +31 -0
  475. package/ruby/Array/uniq.js +16 -0
  476. package/ruby/Math/acos.js +2 -5
  477. package/ruby/Math/asin.js +11 -0
  478. package/ruby/Math/atan.js +11 -0
  479. package/ruby/Math/cbrt.js +13 -0
  480. package/ruby/Math/cos.js +12 -0
  481. package/ruby/Math/cosh.js +11 -0
  482. package/ruby/Math/exp.js +11 -0
  483. package/ruby/Math/index.js +15 -4
  484. package/ruby/Math/log.js +11 -0
  485. package/ruby/Math/log10.js +13 -0
  486. package/ruby/Math/log2.js +13 -0
  487. package/ruby/Math/sin.js +12 -0
  488. package/ruby/Math/sinh.js +11 -0
  489. package/ruby/Math/sqrt.js +13 -0
  490. package/ruby/Math/tan.js +11 -0
  491. package/ruby/Math/tanh.js +11 -0
  492. package/ruby/String/capitalize.js +19 -0
  493. package/ruby/String/chomp.js +27 -0
  494. package/ruby/String/chop.js +25 -0
  495. package/ruby/String/downcase.js +10 -0
  496. package/ruby/String/end_with.js +17 -0
  497. package/ruby/String/include.js +12 -0
  498. package/ruby/String/index.js +11 -0
  499. package/ruby/String/length.js +12 -0
  500. package/ruby/String/reverse.js +12 -0
  501. package/ruby/String/start_with.js +14 -0
  502. package/ruby/String/strip.js +12 -0
  503. package/ruby/String/upcase.js +10 -0
  504. package/ruby/index.js +1 -4
  505. package/_util/cli.js +0 -14
  506. package/_util/cli.js.map +0 -1
  507. package/_util/util.js +0 -620
  508. package/_util/util.js.map +0 -1
  509. package/c/index.js.map +0 -1
  510. package/c/math/abs.js.map +0 -1
  511. package/c/math/frexp.js.map +0 -1
  512. package/c/math/index.js.map +0 -1
  513. package/c/stdio/index.js.map +0 -1
  514. package/c/stdio/sprintf.js.map +0 -1
  515. package/golang/index.js.map +0 -1
  516. package/golang/strings/Contains.js.map +0 -1
  517. package/golang/strings/Count.js.map +0 -1
  518. package/golang/strings/Index2.js.map +0 -1
  519. package/golang/strings/LastIndex.js.map +0 -1
  520. package/golang/strings/index.js.map +0 -1
  521. package/index.js.map +0 -1
  522. package/php/_helpers/_bc.js.map +0 -1
  523. package/php/_helpers/_phpCastString.js.map +0 -1
  524. package/php/_helpers/_php_cast_float.js.map +0 -1
  525. package/php/_helpers/_php_cast_int.js.map +0 -1
  526. package/php/_helpers/index.js.map +0 -1
  527. package/php/array/array_change_key_case.js.map +0 -1
  528. package/php/array/array_chunk.js.map +0 -1
  529. package/php/array/array_column.js.map +0 -1
  530. package/php/array/array_combine.js.map +0 -1
  531. package/php/array/array_count_values.js.map +0 -1
  532. package/php/array/array_diff.js.map +0 -1
  533. package/php/array/array_diff_assoc.js.map +0 -1
  534. package/php/array/array_diff_key.js.map +0 -1
  535. package/php/array/array_diff_uassoc.js.map +0 -1
  536. package/php/array/array_diff_ukey.js.map +0 -1
  537. package/php/array/array_fill.js.map +0 -1
  538. package/php/array/array_fill_keys.js.map +0 -1
  539. package/php/array/array_filter.js.map +0 -1
  540. package/php/array/array_flip.js.map +0 -1
  541. package/php/array/array_intersect.js.map +0 -1
  542. package/php/array/array_intersect_assoc.js.map +0 -1
  543. package/php/array/array_intersect_key.js.map +0 -1
  544. package/php/array/array_intersect_uassoc.js.map +0 -1
  545. package/php/array/array_intersect_ukey.js.map +0 -1
  546. package/php/array/array_key_exists.js.map +0 -1
  547. package/php/array/array_keys.js.map +0 -1
  548. package/php/array/array_map.js.map +0 -1
  549. package/php/array/array_merge.js.map +0 -1
  550. package/php/array/array_merge_recursive.js.map +0 -1
  551. package/php/array/array_multisort.js.map +0 -1
  552. package/php/array/array_pad.js.map +0 -1
  553. package/php/array/array_pop.js.map +0 -1
  554. package/php/array/array_product.js.map +0 -1
  555. package/php/array/array_push.js.map +0 -1
  556. package/php/array/array_rand.js.map +0 -1
  557. package/php/array/array_reduce.js.map +0 -1
  558. package/php/array/array_replace.js.map +0 -1
  559. package/php/array/array_replace_recursive.js.map +0 -1
  560. package/php/array/array_reverse.js.map +0 -1
  561. package/php/array/array_search.js.map +0 -1
  562. package/php/array/array_shift.js.map +0 -1
  563. package/php/array/array_slice.js.map +0 -1
  564. package/php/array/array_splice.js.map +0 -1
  565. package/php/array/array_sum.js.map +0 -1
  566. package/php/array/array_udiff.js.map +0 -1
  567. package/php/array/array_udiff_assoc.js.map +0 -1
  568. package/php/array/array_udiff_uassoc.js.map +0 -1
  569. package/php/array/array_uintersect.js.map +0 -1
  570. package/php/array/array_uintersect_uassoc.js.map +0 -1
  571. package/php/array/array_unique.js.map +0 -1
  572. package/php/array/array_unshift.js.map +0 -1
  573. package/php/array/array_values.js.map +0 -1
  574. package/php/array/array_walk.js.map +0 -1
  575. package/php/array/array_walk_recursive.js.map +0 -1
  576. package/php/array/arsort.js.map +0 -1
  577. package/php/array/asort.js.map +0 -1
  578. package/php/array/count.js.map +0 -1
  579. package/php/array/current.js.map +0 -1
  580. package/php/array/each.js.map +0 -1
  581. package/php/array/end.js.map +0 -1
  582. package/php/array/in_array.js.map +0 -1
  583. package/php/array/index.js.map +0 -1
  584. package/php/array/key.js.map +0 -1
  585. package/php/array/krsort.js.map +0 -1
  586. package/php/array/ksort.js.map +0 -1
  587. package/php/array/natcasesort.js.map +0 -1
  588. package/php/array/natsort.js.map +0 -1
  589. package/php/array/next.js.map +0 -1
  590. package/php/array/pos.js.map +0 -1
  591. package/php/array/prev.js.map +0 -1
  592. package/php/array/range.js.map +0 -1
  593. package/php/array/reset.js.map +0 -1
  594. package/php/array/rsort.js.map +0 -1
  595. package/php/array/shuffle.js.map +0 -1
  596. package/php/array/sizeof.js.map +0 -1
  597. package/php/array/sort.js.map +0 -1
  598. package/php/array/uasort.js.map +0 -1
  599. package/php/array/uksort.js.map +0 -1
  600. package/php/array/usort.js.map +0 -1
  601. package/php/bc/bcadd.js.map +0 -1
  602. package/php/bc/bccomp.js.map +0 -1
  603. package/php/bc/bcdiv.js.map +0 -1
  604. package/php/bc/bcmul.js.map +0 -1
  605. package/php/bc/bcround.js.map +0 -1
  606. package/php/bc/bcscale.js.map +0 -1
  607. package/php/bc/bcsub.js.map +0 -1
  608. package/php/bc/index.js.map +0 -1
  609. package/php/ctype/ctype_alnum.js.map +0 -1
  610. package/php/ctype/ctype_alpha.js.map +0 -1
  611. package/php/ctype/ctype_cntrl.js.map +0 -1
  612. package/php/ctype/ctype_digit.js.map +0 -1
  613. package/php/ctype/ctype_graph.js.map +0 -1
  614. package/php/ctype/ctype_lower.js.map +0 -1
  615. package/php/ctype/ctype_print.js.map +0 -1
  616. package/php/ctype/ctype_punct.js.map +0 -1
  617. package/php/ctype/ctype_space.js.map +0 -1
  618. package/php/ctype/ctype_upper.js.map +0 -1
  619. package/php/ctype/ctype_xdigit.js.map +0 -1
  620. package/php/ctype/index.js.map +0 -1
  621. package/php/datetime/checkdate.js.map +0 -1
  622. package/php/datetime/date.js.map +0 -1
  623. package/php/datetime/date_parse.js.map +0 -1
  624. package/php/datetime/getdate.js.map +0 -1
  625. package/php/datetime/gettimeofday.js.map +0 -1
  626. package/php/datetime/gmdate.js.map +0 -1
  627. package/php/datetime/gmmktime.js.map +0 -1
  628. package/php/datetime/gmstrftime.js.map +0 -1
  629. package/php/datetime/idate.js.map +0 -1
  630. package/php/datetime/index.js.map +0 -1
  631. package/php/datetime/microtime.js.map +0 -1
  632. package/php/datetime/mktime.js.map +0 -1
  633. package/php/datetime/strftime.js.map +0 -1
  634. package/php/datetime/strptime.js.map +0 -1
  635. package/php/datetime/strtotime.js.map +0 -1
  636. package/php/datetime/time.js.map +0 -1
  637. package/php/exec/escapeshellarg.js.map +0 -1
  638. package/php/exec/index.js.map +0 -1
  639. package/php/filesystem/basename.js.map +0 -1
  640. package/php/filesystem/dirname.js.map +0 -1
  641. package/php/filesystem/file_exists.js.map +0 -1
  642. package/php/filesystem/file_get_contents.js.map +0 -1
  643. package/php/filesystem/index.js.map +0 -1
  644. package/php/filesystem/pathinfo.js.map +0 -1
  645. package/php/filesystem/realpath.js.map +0 -1
  646. package/php/funchand/call_user_func.js.map +0 -1
  647. package/php/funchand/call_user_func_array.js.map +0 -1
  648. package/php/funchand/create_function.js.map +0 -1
  649. package/php/funchand/function_exists.js.map +0 -1
  650. package/php/funchand/get_defined_functions.js.map +0 -1
  651. package/php/funchand/index.js.map +0 -1
  652. package/php/i18n/i18n_loc_get_default.js.map +0 -1
  653. package/php/i18n/i18n_loc_set_default.js.map +0 -1
  654. package/php/i18n/index.js.map +0 -1
  655. package/php/index.js.map +0 -1
  656. package/php/info/assert_options.js.map +0 -1
  657. package/php/info/getenv.js.map +0 -1
  658. package/php/info/index.js.map +0 -1
  659. package/php/info/ini_get.js.map +0 -1
  660. package/php/info/ini_set.js.map +0 -1
  661. package/php/info/set_time_limit.js.map +0 -1
  662. package/php/info/version_compare.js.map +0 -1
  663. package/php/json/index.js.map +0 -1
  664. package/php/json/json_decode.js.map +0 -1
  665. package/php/json/json_encode.js.map +0 -1
  666. package/php/json/json_last_error.js.map +0 -1
  667. package/php/math/abs.js.map +0 -1
  668. package/php/math/acos.js.map +0 -1
  669. package/php/math/acosh.js.map +0 -1
  670. package/php/math/asin.js.map +0 -1
  671. package/php/math/asinh.js.map +0 -1
  672. package/php/math/atan.js.map +0 -1
  673. package/php/math/atan2.js.map +0 -1
  674. package/php/math/atanh.js.map +0 -1
  675. package/php/math/base_convert.js.map +0 -1
  676. package/php/math/bindec.js.map +0 -1
  677. package/php/math/ceil.js.map +0 -1
  678. package/php/math/cos.js.map +0 -1
  679. package/php/math/cosh.js.map +0 -1
  680. package/php/math/decbin.js.map +0 -1
  681. package/php/math/dechex.js.map +0 -1
  682. package/php/math/decoct.js.map +0 -1
  683. package/php/math/deg2rad.js.map +0 -1
  684. package/php/math/exp.js.map +0 -1
  685. package/php/math/expm1.js.map +0 -1
  686. package/php/math/floor.js.map +0 -1
  687. package/php/math/fmod.js.map +0 -1
  688. package/php/math/getrandmax.js.map +0 -1
  689. package/php/math/hexdec.js.map +0 -1
  690. package/php/math/hypot.js.map +0 -1
  691. package/php/math/index.js.map +0 -1
  692. package/php/math/is_finite.js.map +0 -1
  693. package/php/math/is_infinite.js.map +0 -1
  694. package/php/math/is_nan.js.map +0 -1
  695. package/php/math/lcg_value.js.map +0 -1
  696. package/php/math/log.js.map +0 -1
  697. package/php/math/log10.js.map +0 -1
  698. package/php/math/log1p.js.map +0 -1
  699. package/php/math/max.js.map +0 -1
  700. package/php/math/min.js.map +0 -1
  701. package/php/math/mt_getrandmax.js.map +0 -1
  702. package/php/math/mt_rand.js.map +0 -1
  703. package/php/math/octdec.js.map +0 -1
  704. package/php/math/pi.js.map +0 -1
  705. package/php/math/pow.js.map +0 -1
  706. package/php/math/rad2deg.js.map +0 -1
  707. package/php/math/rand.js.map +0 -1
  708. package/php/math/round.js.map +0 -1
  709. package/php/math/sin.js.map +0 -1
  710. package/php/math/sinh.js.map +0 -1
  711. package/php/math/sqrt.js.map +0 -1
  712. package/php/math/tan.js.map +0 -1
  713. package/php/math/tanh.js.map +0 -1
  714. package/php/misc/index.js.map +0 -1
  715. package/php/misc/pack.js.map +0 -1
  716. package/php/misc/uniqid.js.map +0 -1
  717. package/php/net-gopher/gopher_parsedir.js.map +0 -1
  718. package/php/net-gopher/index.js.map +0 -1
  719. package/php/network/index.js.map +0 -1
  720. package/php/network/inet_ntop.js.map +0 -1
  721. package/php/network/inet_pton.js.map +0 -1
  722. package/php/network/ip2long.js.map +0 -1
  723. package/php/network/long2ip.js.map +0 -1
  724. package/php/network/setcookie.js.map +0 -1
  725. package/php/network/setrawcookie.js.map +0 -1
  726. package/php/pcre/index.js.map +0 -1
  727. package/php/pcre/preg_match.js.map +0 -1
  728. package/php/pcre/preg_quote.js.map +0 -1
  729. package/php/pcre/preg_replace.js.map +0 -1
  730. package/php/pcre/sql_regcase.js.map +0 -1
  731. package/php/strings/addcslashes.js.map +0 -1
  732. package/php/strings/addslashes.js.map +0 -1
  733. package/php/strings/bin2hex.js.map +0 -1
  734. package/php/strings/chop.js.map +0 -1
  735. package/php/strings/chr.js.map +0 -1
  736. package/php/strings/chunk_split.js.map +0 -1
  737. package/php/strings/convert_cyr_string.js.map +0 -1
  738. package/php/strings/convert_uuencode.js.map +0 -1
  739. package/php/strings/count_chars.js.map +0 -1
  740. package/php/strings/crc32.js.map +0 -1
  741. package/php/strings/echo.js.map +0 -1
  742. package/php/strings/explode.js.map +0 -1
  743. package/php/strings/get_html_translation_table.js.map +0 -1
  744. package/php/strings/hex2bin.js.map +0 -1
  745. package/php/strings/html_entity_decode.js.map +0 -1
  746. package/php/strings/htmlentities.js.map +0 -1
  747. package/php/strings/htmlspecialchars.js.map +0 -1
  748. package/php/strings/htmlspecialchars_decode.js.map +0 -1
  749. package/php/strings/implode.js.map +0 -1
  750. package/php/strings/index.js.map +0 -1
  751. package/php/strings/join.js.map +0 -1
  752. package/php/strings/lcfirst.js.map +0 -1
  753. package/php/strings/levenshtein.js.map +0 -1
  754. package/php/strings/localeconv.js.map +0 -1
  755. package/php/strings/ltrim.js.map +0 -1
  756. package/php/strings/md5.js.map +0 -1
  757. package/php/strings/md5_file.js.map +0 -1
  758. package/php/strings/metaphone.js.map +0 -1
  759. package/php/strings/money_format.js.map +0 -1
  760. package/php/strings/nl2br.js.map +0 -1
  761. package/php/strings/nl_langinfo.js.map +0 -1
  762. package/php/strings/number_format.js.map +0 -1
  763. package/php/strings/ord.js.map +0 -1
  764. package/php/strings/parse_str.js.map +0 -1
  765. package/php/strings/printf.js.map +0 -1
  766. package/php/strings/quoted_printable_decode.js.map +0 -1
  767. package/php/strings/quoted_printable_encode.js.map +0 -1
  768. package/php/strings/quotemeta.js.map +0 -1
  769. package/php/strings/rtrim.js.map +0 -1
  770. package/php/strings/setlocale.js.map +0 -1
  771. package/php/strings/sha1.js.map +0 -1
  772. package/php/strings/sha1_file.js.map +0 -1
  773. package/php/strings/similar_text.js.map +0 -1
  774. package/php/strings/soundex.js.map +0 -1
  775. package/php/strings/split.js.map +0 -1
  776. package/php/strings/sprintf.js.map +0 -1
  777. package/php/strings/sscanf.js.map +0 -1
  778. package/php/strings/str_getcsv.js.map +0 -1
  779. package/php/strings/str_ireplace.js.map +0 -1
  780. package/php/strings/str_pad.js.map +0 -1
  781. package/php/strings/str_repeat.js.map +0 -1
  782. package/php/strings/str_replace.js.map +0 -1
  783. package/php/strings/str_rot13.js.map +0 -1
  784. package/php/strings/str_shuffle.js.map +0 -1
  785. package/php/strings/str_split.js.map +0 -1
  786. package/php/strings/str_word_count.js.map +0 -1
  787. package/php/strings/strcasecmp.js.map +0 -1
  788. package/php/strings/strchr.js.map +0 -1
  789. package/php/strings/strcmp.js.map +0 -1
  790. package/php/strings/strcoll.js.map +0 -1
  791. package/php/strings/strcspn.js.map +0 -1
  792. package/php/strings/strip_tags.js.map +0 -1
  793. package/php/strings/stripos.js.map +0 -1
  794. package/php/strings/stripslashes.js.map +0 -1
  795. package/php/strings/stristr.js.map +0 -1
  796. package/php/strings/strlen.js.map +0 -1
  797. package/php/strings/strnatcasecmp.js.map +0 -1
  798. package/php/strings/strnatcmp.js.map +0 -1
  799. package/php/strings/strncasecmp.js.map +0 -1
  800. package/php/strings/strncmp.js.map +0 -1
  801. package/php/strings/strpbrk.js.map +0 -1
  802. package/php/strings/strpos.js.map +0 -1
  803. package/php/strings/strrchr.js.map +0 -1
  804. package/php/strings/strrev.js.map +0 -1
  805. package/php/strings/strripos.js.map +0 -1
  806. package/php/strings/strrpos.js.map +0 -1
  807. package/php/strings/strspn.js.map +0 -1
  808. package/php/strings/strstr.js.map +0 -1
  809. package/php/strings/strtok.js.map +0 -1
  810. package/php/strings/strtolower.js.map +0 -1
  811. package/php/strings/strtoupper.js.map +0 -1
  812. package/php/strings/strtr.js.map +0 -1
  813. package/php/strings/substr.js.map +0 -1
  814. package/php/strings/substr_compare.js.map +0 -1
  815. package/php/strings/substr_count.js.map +0 -1
  816. package/php/strings/substr_replace.js.map +0 -1
  817. package/php/strings/trim.js.map +0 -1
  818. package/php/strings/ucfirst.js.map +0 -1
  819. package/php/strings/ucwords.js.map +0 -1
  820. package/php/strings/vprintf.js.map +0 -1
  821. package/php/strings/vsprintf.js.map +0 -1
  822. package/php/strings/wordwrap.js.map +0 -1
  823. package/php/url/base64_decode.js.map +0 -1
  824. package/php/url/base64_encode.js.map +0 -1
  825. package/php/url/http_build_query.js.map +0 -1
  826. package/php/url/index.js.map +0 -1
  827. package/php/url/parse_url.js.map +0 -1
  828. package/php/url/rawurldecode.js.map +0 -1
  829. package/php/url/rawurlencode.js.map +0 -1
  830. package/php/url/urldecode.js.map +0 -1
  831. package/php/url/urlencode.js.map +0 -1
  832. package/php/var/boolval.js.map +0 -1
  833. package/php/var/doubleval.js.map +0 -1
  834. package/php/var/empty.js.map +0 -1
  835. package/php/var/floatval.js.map +0 -1
  836. package/php/var/gettype.js.map +0 -1
  837. package/php/var/index.js.map +0 -1
  838. package/php/var/intval.js.map +0 -1
  839. package/php/var/is_array.js.map +0 -1
  840. package/php/var/is_binary.js.map +0 -1
  841. package/php/var/is_bool.js.map +0 -1
  842. package/php/var/is_buffer.js.map +0 -1
  843. package/php/var/is_callable.js.map +0 -1
  844. package/php/var/is_double.js.map +0 -1
  845. package/php/var/is_float.js.map +0 -1
  846. package/php/var/is_int.js.map +0 -1
  847. package/php/var/is_integer.js.map +0 -1
  848. package/php/var/is_long.js.map +0 -1
  849. package/php/var/is_null.js.map +0 -1
  850. package/php/var/is_numeric.js.map +0 -1
  851. package/php/var/is_object.js.map +0 -1
  852. package/php/var/is_real.js.map +0 -1
  853. package/php/var/is_scalar.js.map +0 -1
  854. package/php/var/is_string.js.map +0 -1
  855. package/php/var/is_unicode.js.map +0 -1
  856. package/php/var/isset.js.map +0 -1
  857. package/php/var/print_r.js.map +0 -1
  858. package/php/var/serialize.js.map +0 -1
  859. package/php/var/serialize.mocha.js +0 -14
  860. package/php/var/serialize.mocha.js.map +0 -1
  861. package/php/var/strval.js.map +0 -1
  862. package/php/var/unserialize.js.map +0 -1
  863. package/php/var/var_dump.js.map +0 -1
  864. package/php/var/var_export.js.map +0 -1
  865. package/php/xdiff/index.js.map +0 -1
  866. package/php/xdiff/xdiff_string_diff.js.map +0 -1
  867. package/php/xdiff/xdiff_string_patch.js.map +0 -1
  868. package/php/xml/index.js.map +0 -1
  869. package/php/xml/utf8_decode.js.map +0 -1
  870. package/php/xml/utf8_encode.js.map +0 -1
  871. package/python/index.js.map +0 -1
  872. package/python/string/ascii_letters.js.map +0 -1
  873. package/python/string/ascii_lowercase.js.map +0 -1
  874. package/python/string/ascii_uppercase.js.map +0 -1
  875. package/python/string/capwords.js.map +0 -1
  876. package/python/string/index.js.map +0 -1
  877. package/python/string/punctuation.js.map +0 -1
  878. package/ruby/Math/acos.js.map +0 -1
  879. package/ruby/Math/index.js.map +0 -1
  880. package/ruby/index.js.map +0 -1
@@ -1,5 +1,3 @@
1
- "use strict";
2
-
3
1
  module.exports = function array_reduce(aInput, callback) {
4
2
  // discuss at: https://locutus.io/php/array_reduce/
5
3
  // original by: Alfonso Jimenez (https://www.alfonsojimenez.com)
@@ -7,22 +5,21 @@ module.exports = function array_reduce(aInput, callback) {
7
5
  // example 1: array_reduce([1, 2, 3, 4, 5], function (v, w){v += w;return v;})
8
6
  // returns 1: 15
9
7
 
10
- var lon = aInput.length;
11
- var res = 0;
12
- var i = 0;
13
- var tmp = [];
8
+ const lon = aInput.length
9
+ let res = 0
10
+ let i = 0
11
+ let tmp = []
14
12
 
15
13
  for (i = 0; i < lon; i += 2) {
16
- tmp[0] = aInput[i];
14
+ tmp[0] = aInput[i]
17
15
  if (aInput[i + 1]) {
18
- tmp[1] = aInput[i + 1];
16
+ tmp[1] = aInput[i + 1]
19
17
  } else {
20
- tmp[1] = 0;
18
+ tmp[1] = 0
21
19
  }
22
- res += callback.apply(null, tmp);
23
- tmp = [];
20
+ res += callback.apply(null, tmp)
21
+ tmp = []
24
22
  }
25
23
 
26
- return res;
27
- };
28
- //# sourceMappingURL=array_reduce.js.map
24
+ return res
25
+ }
@@ -1,33 +1,30 @@
1
- 'use strict';
2
-
3
1
  module.exports = function array_replace(arr) {
4
2
  // discuss at: https://locutus.io/php/array_replace/
5
3
  // original by: Brett Zamir (https://brett-zamir.me)
6
4
  // example 1: array_replace(["orange", "banana", "apple", "raspberry"], {0 : "pineapple", 4 : "cherry"}, {0:"grape"})
7
5
  // returns 1: {0: 'grape', 1: 'banana', 2: 'apple', 3: 'raspberry', 4: 'cherry'}
8
6
 
9
- var retObj = {};
10
- var i = 0;
11
- var p = '';
12
- var argl = arguments.length;
7
+ const retObj = {}
8
+ let i = 0
9
+ let p = ''
10
+ const argl = arguments.length
13
11
 
14
12
  if (argl < 2) {
15
- throw new Error('There should be at least 2 arguments passed to array_replace()');
13
+ throw new Error('There should be at least 2 arguments passed to array_replace()')
16
14
  }
17
15
 
18
16
  // Although docs state that the arguments are passed in by reference,
19
17
  // it seems they are not altered, but rather the copy that is returned
20
18
  // (just guessing), so we make a copy here, instead of acting on arr itself
21
19
  for (p in arr) {
22
- retObj[p] = arr[p];
20
+ retObj[p] = arr[p]
23
21
  }
24
22
 
25
23
  for (i = 1; i < argl; i++) {
26
24
  for (p in arguments[i]) {
27
- retObj[p] = arguments[i][p];
25
+ retObj[p] = arguments[i][p]
28
26
  }
29
27
  }
30
28
 
31
- return retObj;
32
- };
33
- //# sourceMappingURL=array_replace.js.map
29
+ return retObj
30
+ }
@@ -1,47 +1,43 @@
1
- 'use strict';
2
-
3
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
-
5
1
  module.exports = function array_replace_recursive(arr) {
6
- // discuss at: https://locutus.io/php/array_replace_recursive/
7
- // original by: Brett Zamir (https://brett-zamir.me)
8
- // example 1: array_replace_recursive({'citrus' : ['orange'], 'berries' : ['blackberry', 'raspberry']}, {'citrus' : ['pineapple'], 'berries' : ['blueberry']})
9
- // returns 1: {citrus : ['pineapple'], berries : ['blueberry', 'raspberry']}
2
+ // discuss at: https://locutus.io/php/array_replace_recursive/
3
+ // parity verified: PHP 8.3
4
+ // original by: Brett Zamir (https://brett-zamir.me)
5
+ // example 1: array_replace_recursive({'citrus' : ['orange'], 'berries' : ['blackberry', 'raspberry']}, {'citrus' : ['pineapple'], 'berries' : ['blueberry']})
6
+ // returns 1: {citrus : ['pineapple'], berries : ['blueberry', 'raspberry']}
10
7
 
11
- var i = 0;
12
- var p = '';
13
- var argl = arguments.length;
14
- var retObj = void 0;
8
+ let i = 0
9
+ let p = ''
10
+ const argl = arguments.length
11
+ let retObj
15
12
 
16
13
  if (argl < 2) {
17
- throw new Error('There should be at least 2 arguments passed to array_replace_recursive()');
14
+ throw new Error('There should be at least 2 arguments passed to array_replace_recursive()')
18
15
  }
19
16
 
20
17
  // Although docs state that the arguments are passed in by reference,
21
18
  // it seems they are not altered, but rather the copy that is returned
22
19
  // So we make a copy here, instead of acting on arr itself
23
- if (Object.prototype.toString.call(arr) === '[object Array]') {
24
- retObj = [];
20
+ if (Array.isArray(arr)) {
21
+ retObj = []
25
22
  for (p in arr) {
26
- retObj.push(arr[p]);
23
+ retObj.push(arr[p])
27
24
  }
28
25
  } else {
29
- retObj = {};
26
+ retObj = {}
30
27
  for (p in arr) {
31
- retObj[p] = arr[p];
28
+ retObj[p] = arr[p]
32
29
  }
33
30
  }
34
31
 
35
32
  for (i = 1; i < argl; i++) {
36
33
  for (p in arguments[i]) {
37
- if (retObj[p] && _typeof(retObj[p]) === 'object') {
38
- retObj[p] = array_replace_recursive(retObj[p], arguments[i][p]);
34
+ if (retObj[p] && typeof retObj[p] === 'object') {
35
+ retObj[p] = array_replace_recursive(retObj[p], arguments[i][p])
39
36
  } else {
40
- retObj[p] = arguments[i][p];
37
+ retObj[p] = arguments[i][p]
41
38
  }
42
39
  }
43
40
  }
44
41
 
45
- return retObj;
46
- };
47
- //# sourceMappingURL=array_replace_recursive.js.map
42
+ return retObj
43
+ }
@@ -1,5 +1,3 @@
1
- 'use strict';
2
-
3
1
  module.exports = function array_reverse(array, preserveKeys) {
4
2
  // discuss at: https://locutus.io/php/array_reverse/
5
3
  // original by: Kevin van Zonneveld (https://kvz.io)
@@ -7,34 +5,33 @@ module.exports = function array_reverse(array, preserveKeys) {
7
5
  // example 1: array_reverse( [ 'php', '4.0', ['green', 'red'] ], true)
8
6
  // returns 1: { 2: ['green', 'red'], 1: '4.0', 0: 'php'}
9
7
 
10
- var isArray = Object.prototype.toString.call(array) === '[object Array]';
11
- var tmpArr = preserveKeys ? {} : [];
12
- var key = void 0;
8
+ const isArray = Array.isArray(array)
9
+ const tmpArr = preserveKeys ? {} : []
10
+ let key
13
11
 
14
12
  if (isArray && !preserveKeys) {
15
- return array.slice(0).reverse();
13
+ return array.slice(0).reverse()
16
14
  }
17
15
 
18
16
  if (preserveKeys) {
19
- var keys = [];
17
+ const keys = []
20
18
  for (key in array) {
21
- keys.push(key);
19
+ keys.push(key)
22
20
  }
23
21
 
24
- var i = keys.length;
22
+ let i = keys.length
25
23
  while (i--) {
26
- key = keys[i];
24
+ key = keys[i]
27
25
  // @todo: don't rely on browsers keeping keys in insertion order
28
26
  // it's implementation specific
29
27
  // eg. the result will differ from expected in Google Chrome
30
- tmpArr[key] = array[key];
28
+ tmpArr[key] = array[key]
31
29
  }
32
30
  } else {
33
31
  for (key in array) {
34
- tmpArr.unshift(array[key]);
32
+ tmpArr.unshift(array[key])
35
33
  }
36
34
  }
37
35
 
38
- return tmpArr;
39
- };
40
- //# sourceMappingURL=array_reverse.js.map
36
+ return tmpArr
37
+ }
@@ -1,50 +1,48 @@
1
- 'use strict';
2
-
3
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
-
5
1
  module.exports = function array_search(needle, haystack, argStrict) {
6
- // discuss at: https://locutus.io/php/array_search/
7
- // original by: Kevin van Zonneveld (https://kvz.io)
8
- // input by: Brett Zamir (https://brett-zamir.me)
9
- // bugfixed by: Kevin van Zonneveld (https://kvz.io)
10
- // bugfixed by: Reynier de la Rosa (https://scriptinside.blogspot.com.es/)
11
- // test: skip-all
12
- // example 1: array_search('zonneveld', {firstname: 'kevin', middle: 'van', surname: 'zonneveld'})
13
- // returns 1: 'surname'
14
- // example 2: array_search('3', {a: 3, b: 5, c: 7})
15
- // returns 2: 'a'
2
+ // discuss at: https://locutus.io/php/array_search/
3
+ // parity verified: PHP 8.3
4
+ // original by: Kevin van Zonneveld (https://kvz.io)
5
+ // input by: Brett Zamir (https://brett-zamir.me)
6
+ // bugfixed by: Kevin van Zonneveld (https://kvz.io)
7
+ // bugfixed by: Reynier de la Rosa (https://scriptinside.blogspot.com.es/)
8
+ // example 1: array_search('zonneveld', {firstname: 'kevin', middle: 'van', surname: 'zonneveld'})
9
+ // returns 1: 'surname'
10
+ // example 2: array_search('3', {a: 3, b: 5, c: 7})
11
+ // returns 2: 'a'
16
12
 
17
- var strict = !!argStrict;
18
- var key = '';
13
+ const strict = !!argStrict
14
+ let key = ''
19
15
 
20
- if ((typeof needle === 'undefined' ? 'undefined' : _typeof(needle)) === 'object' && needle.exec) {
16
+ if (typeof needle === 'object' && needle.exec) {
21
17
  // Duck-type for RegExp
22
18
  if (!strict) {
23
19
  // Let's consider case sensitive searches as strict
24
- var flags = 'i' + (needle.global ? 'g' : '') + (needle.multiline ? 'm' : '') + (
25
- // sticky is FF only
26
- needle.sticky ? 'y' : '');
27
- needle = new RegExp(needle.source, flags);
20
+ const flags =
21
+ 'i' +
22
+ (needle.global ? 'g' : '') +
23
+ (needle.multiline ? 'm' : '') +
24
+ // sticky is FF only
25
+ (needle.sticky ? 'y' : '')
26
+ needle = new RegExp(needle.source, flags)
28
27
  }
29
28
  for (key in haystack) {
30
29
  if (haystack.hasOwnProperty(key)) {
31
30
  if (needle.test(haystack[key])) {
32
- return key;
31
+ return key
33
32
  }
34
33
  }
35
34
  }
36
- return false;
35
+ return false
37
36
  }
38
37
 
39
38
  for (key in haystack) {
40
39
  if (haystack.hasOwnProperty(key)) {
41
- // eslint-disable-next-line eqeqeq
42
- if (strict && haystack[key] === needle || !strict && haystack[key] == needle) {
43
- return key;
40
+ // biome-ignore lint/suspicious/noDoubleEquals: non-strict comparison intended
41
+ if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
42
+ return key
44
43
  }
45
44
  }
46
45
  }
47
46
 
48
- return false;
49
- };
50
- //# sourceMappingURL=array_search.js.map
47
+ return false
48
+ }
@@ -1,5 +1,3 @@
1
- "use strict";
2
-
3
1
  module.exports = function array_shift(inputArr) {
4
2
  // discuss at: https://locutus.io/php/array_shift/
5
3
  // original by: Kevin van Zonneveld (https://kvz.io)
@@ -9,10 +7,9 @@ module.exports = function array_shift(inputArr) {
9
7
  // returns 1: 'Kevin'
10
8
 
11
9
  if (inputArr.length === 0) {
12
- return null;
10
+ return null
13
11
  }
14
12
  if (inputArr.length > 0) {
15
- return inputArr.shift();
13
+ return inputArr.shift()
16
14
  }
17
- };
18
- //# sourceMappingURL=array_shift.js.map
15
+ }
@@ -1,17 +1,16 @@
1
- 'use strict';
2
-
3
1
  module.exports = function array_slice(arr, offst, lgth, preserveKeys) {
4
- // discuss at: https://locutus.io/php/array_slice/
5
- // original by: Brett Zamir (https://brett-zamir.me)
6
- // input by: Brett Zamir (https://brett-zamir.me)
7
- // bugfixed by: Kevin van Zonneveld (https://kvz.io)
8
- // note 1: Relies on is_int because !isNaN accepts floats
9
- // example 1: array_slice(["a", "b", "c", "d", "e"], 2, -1)
10
- // returns 1: [ 'c', 'd' ]
11
- // example 2: array_slice(["a", "b", "c", "d", "e"], 2, -1, true)
12
- // returns 2: {2: 'c', 3: 'd'}
2
+ // discuss at: https://locutus.io/php/array_slice/
3
+ // parity verified: PHP 8.3
4
+ // original by: Brett Zamir (https://brett-zamir.me)
5
+ // input by: Brett Zamir (https://brett-zamir.me)
6
+ // bugfixed by: Kevin van Zonneveld (https://kvz.io)
7
+ // note 1: Relies on is_int because !isNaN accepts floats
8
+ // example 1: array_slice(["a", "b", "c", "d", "e"], 2, -1)
9
+ // returns 1: [ 'c', 'd' ]
10
+ // example 2: array_slice(["a", "b", "c", "d", "e"], 2, -1, true)
11
+ // returns 2: {2: 'c', 3: 'd'}
13
12
 
14
- var isInt = require('../var/is_int');
13
+ const isInt = require('../var/is_int')
15
14
 
16
15
  /*
17
16
  if ('callee' in arr && 'length' in arr) {
@@ -19,56 +18,55 @@ module.exports = function array_slice(arr, offst, lgth, preserveKeys) {
19
18
  }
20
19
  */
21
20
 
22
- var key = '';
21
+ let key = ''
23
22
 
24
- if (Object.prototype.toString.call(arr) !== '[object Array]' || preserveKeys && offst !== 0) {
23
+ if (!Array.isArray(arr) || (preserveKeys && offst !== 0)) {
25
24
  // Assoc. array as input or if required as output
26
- var lgt = 0;
27
- var newAssoc = {};
25
+ let lgt = 0
26
+ const newAssoc = {}
28
27
  for (key in arr) {
29
- lgt += 1;
30
- newAssoc[key] = arr[key];
28
+ lgt += 1
29
+ newAssoc[key] = arr[key]
31
30
  }
32
- arr = newAssoc;
31
+ arr = newAssoc
33
32
 
34
- offst = offst < 0 ? lgt + offst : offst;
35
- lgth = lgth === undefined ? lgt : lgth < 0 ? lgt + lgth - offst : lgth;
33
+ offst = offst < 0 ? lgt + offst : offst
34
+ lgth = lgth === undefined ? lgt : lgth < 0 ? lgt + lgth - offst : lgth
36
35
 
37
- var assoc = {};
38
- var start = false;
39
- var it = -1;
40
- var arrlgth = 0;
41
- var noPkIdx = 0;
36
+ const assoc = {}
37
+ let start = false
38
+ let it = -1
39
+ let arrlgth = 0
40
+ let noPkIdx = 0
42
41
 
43
42
  for (key in arr) {
44
- ++it;
43
+ ++it
45
44
  if (arrlgth >= lgth) {
46
- break;
45
+ break
47
46
  }
48
47
  if (it === offst) {
49
- start = true;
48
+ start = true
50
49
  }
51
50
  if (!start) {
52
- continue;
51
+ continue
53
52
  }
54
- ++arrlgth;
53
+ ++arrlgth
55
54
  if (isInt(key) && !preserveKeys) {
56
- assoc[noPkIdx++] = arr[key];
55
+ assoc[noPkIdx++] = arr[key]
57
56
  } else {
58
- assoc[key] = arr[key];
57
+ assoc[key] = arr[key]
59
58
  }
60
59
  }
61
60
  // Make as array-like object (though length will not be dynamic)
62
61
  // assoc.length = arrlgth;
63
- return assoc;
62
+ return assoc
64
63
  }
65
64
 
66
65
  if (lgth === undefined) {
67
- return arr.slice(offst);
66
+ return arr.slice(offst)
68
67
  } else if (lgth >= 0) {
69
- return arr.slice(offst, offst + lgth);
68
+ return arr.slice(offst, offst + lgth)
70
69
  } else {
71
- return arr.slice(offst, lgth);
70
+ return arr.slice(offst, lgth)
72
71
  }
73
- };
74
- //# sourceMappingURL=array_slice.js.map
72
+ }
@@ -1,122 +1,117 @@
1
- 'use strict';
2
-
3
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
-
5
1
  module.exports = function array_splice(arr, offst, lgth, replacement) {
6
- // discuss at: https://locutus.io/php/array_splice/
7
- // original by: Brett Zamir (https://brett-zamir.me)
8
- // input by: Theriault (https://github.com/Theriault)
9
- // note 1: Order does get shifted in associative array input with numeric indices,
10
- // note 1: since PHP behavior doesn't preserve keys, but I understand order is
11
- // note 1: not reliable anyways
12
- // note 1: Note also that IE retains information about property position even
13
- // note 1: after being supposedly deleted, so use of this function may produce
14
- // note 1: unexpected results in IE if you later attempt to add back properties
15
- // note 1: with the same keys that had been deleted
16
- // example 1: var $input = {4: "red", 'abc': "green", 2: "blue", 'dud': "yellow"}
17
- // example 1: array_splice($input, 2)
18
- // returns 1: {4: "red", 'abc': "green"}
19
- // example 2: var $input = ["red", "green", "blue", "yellow"]
20
- // example 2: array_splice($input, 3, 0, "purple")
21
- // returns 2: []
22
- // example 3: var $input = ["red", "green", "blue", "yellow"]
23
- // example 3: array_splice($input, -1, 1, ["black", "maroon"])
24
- // returns 3: ["yellow"]
25
- // test: skip-1
2
+ // discuss at: https://locutus.io/php/array_splice/
3
+ // parity verified: PHP 8.3
4
+ // original by: Brett Zamir (https://brett-zamir.me)
5
+ // input by: Theriault (https://github.com/Theriault)
6
+ // note 1: Order does get shifted in associative array input with numeric indices,
7
+ // note 1: since PHP behavior doesn't preserve keys, but I understand order is
8
+ // note 1: not reliable anyways
9
+ // note 1: Note also that IE retains information about property position even
10
+ // note 1: after being supposedly deleted, so use of this function may produce
11
+ // note 1: unexpected results in IE if you later attempt to add back properties
12
+ // note 1: with the same keys that had been deleted
13
+ // example 1: var $input = ["red", "green", "blue", "yellow"]
14
+ // example 1: array_splice($input, 2)
15
+ // returns 1: ["blue", "yellow"]
16
+ // example 2: var $input = ["red", "green", "blue", "yellow"]
17
+ // example 2: array_splice($input, 3, 0, "purple")
18
+ // returns 2: []
19
+ // example 3: var $input = ["red", "green", "blue", "yellow"]
20
+ // example 3: array_splice($input, -1, 1, ["black", "maroon"])
21
+ // returns 3: ["yellow"]
26
22
 
27
- var isInt = require('../var/is_int');
23
+ const isInt = require('../var/is_int')
28
24
 
29
- var _checkToUpIndices = function _checkToUpIndices(arr, ct, key) {
25
+ const _checkToUpIndices = function (arr, ct, key) {
30
26
  // Deal with situation, e.g., if encounter index 4 and try
31
27
  // to set it to 0, but 0 exists later in loop (need to
32
28
  // increment all subsequent (skipping current key,
33
29
  // since we need its value below) until find unused)
34
30
  if (arr[ct] !== undefined) {
35
- var tmp = ct;
36
- ct += 1;
31
+ const tmp = ct
32
+ ct += 1
37
33
  if (ct === key) {
38
- ct += 1;
34
+ ct += 1
39
35
  }
40
- ct = _checkToUpIndices(arr, ct, key);
41
- arr[ct] = arr[tmp];
42
- delete arr[tmp];
36
+ ct = _checkToUpIndices(arr, ct, key)
37
+ arr[ct] = arr[tmp]
38
+ delete arr[tmp]
43
39
  }
44
- return ct;
45
- };
40
+ return ct
41
+ }
46
42
 
47
- if (replacement && (typeof replacement === 'undefined' ? 'undefined' : _typeof(replacement)) !== 'object') {
48
- replacement = [replacement];
43
+ if (replacement && typeof replacement !== 'object') {
44
+ replacement = [replacement]
49
45
  }
50
46
  if (lgth === undefined) {
51
- lgth = offst >= 0 ? arr.length - offst : -offst;
47
+ lgth = offst >= 0 ? arr.length - offst : -offst
52
48
  } else if (lgth < 0) {
53
- lgth = (offst >= 0 ? arr.length - offst : -offst) + lgth;
49
+ lgth = (offst >= 0 ? arr.length - offst : -offst) + lgth
54
50
  }
55
51
 
56
- if (Object.prototype.toString.call(arr) !== '[object Array]') {
52
+ if (!Array.isArray(arr)) {
57
53
  /* if (arr.length !== undefined) {
58
54
  // Deal with array-like objects as input
59
55
  delete arr.length;
60
56
  } */
61
- var lgt = 0;
62
- var ct = -1;
63
- var rmvd = [];
64
- var rmvdObj = {};
65
- var replCt = -1;
66
- var intCt = -1;
67
- var returnArr = true;
68
- var rmvdCt = 0;
57
+ let lgt = 0
58
+ let ct = -1
59
+ const rmvd = []
60
+ const rmvdObj = {}
61
+ let replCt = -1
62
+ let intCt = -1
63
+ let returnArr = true
64
+ let rmvdCt = 0
69
65
  // var rmvdLngth = 0
70
- var key = '';
66
+ let key = ''
71
67
  // rmvdObj.length = 0;
72
68
  for (key in arr) {
73
69
  // Can do arr.__count__ in some browsers
74
- lgt += 1;
70
+ lgt += 1
75
71
  }
76
- offst = offst >= 0 ? offst : lgt + offst;
72
+ offst = offst >= 0 ? offst : lgt + offst
77
73
  for (key in arr) {
78
- ct += 1;
74
+ ct += 1
79
75
  if (ct < offst) {
80
76
  if (isInt(key)) {
81
- intCt += 1;
77
+ intCt += 1
82
78
  if (parseInt(key, 10) === intCt) {
83
79
  // Key is already numbered ok, so don't need to change key for value
84
- continue;
80
+ continue
85
81
  }
86
82
  // Deal with situation, e.g.,
87
- _checkToUpIndices(arr, intCt, key);
83
+ _checkToUpIndices(arr, intCt, key)
88
84
  // if encounter index 4 and try to set it to 0, but 0 exists later in loop
89
- arr[intCt] = arr[key];
90
- delete arr[key];
85
+ arr[intCt] = arr[key]
86
+ delete arr[key]
91
87
  }
92
- continue;
88
+ continue
93
89
  }
94
90
  if (returnArr && isInt(key)) {
95
- rmvd.push(arr[key]);
91
+ rmvd.push(arr[key])
96
92
  // PHP starts over here too
97
- rmvdObj[rmvdCt++] = arr[key];
93
+ rmvdObj[rmvdCt++] = arr[key]
98
94
  } else {
99
- rmvdObj[key] = arr[key];
100
- returnArr = false;
95
+ rmvdObj[key] = arr[key]
96
+ returnArr = false
101
97
  }
102
98
  // rmvdLngth += 1
103
99
  // rmvdObj.length += 1;
104
100
  if (replacement && replacement[++replCt]) {
105
- arr[key] = replacement[replCt];
101
+ arr[key] = replacement[replCt]
106
102
  } else {
107
- delete arr[key];
103
+ delete arr[key]
108
104
  }
109
105
  }
110
106
  // Make (back) into an array-like object
111
107
  // arr.length = lgt - rmvdLngth + (replacement ? replacement.length : 0);
112
- return returnArr ? rmvd : rmvdObj;
108
+ return returnArr ? rmvd : rmvdObj
113
109
  }
114
110
 
115
111
  if (replacement) {
116
- replacement.unshift(offst, lgth);
117
- return Array.prototype.splice.apply(arr, replacement);
112
+ replacement.unshift(offst, lgth)
113
+ return Array.prototype.splice.apply(arr, replacement)
118
114
  }
119
115
 
120
- return arr.splice(offst, lgth);
121
- };
122
- //# sourceMappingURL=array_splice.js.map
116
+ return arr.splice(offst, lgth)
117
+ }
@@ -1,7 +1,3 @@
1
- 'use strict';
2
-
3
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
-
5
1
  module.exports = function array_sum(array) {
6
2
  // discuss at: https://locutus.io/php/array_sum/
7
3
  // original by: Kevin van Zonneveld (https://kvz.io)
@@ -17,20 +13,19 @@ module.exports = function array_sum(array) {
17
13
  // example 2: array_sum($total)
18
14
  // returns 2: 67.2
19
15
 
20
- var key = void 0;
21
- var sum = 0;
16
+ let key
17
+ let sum = 0
22
18
 
23
19
  // input sanitation
24
- if ((typeof array === 'undefined' ? 'undefined' : _typeof(array)) !== 'object') {
25
- return null;
20
+ if (typeof array !== 'object') {
21
+ return null
26
22
  }
27
23
 
28
24
  for (key in array) {
29
25
  if (!isNaN(parseFloat(array[key]))) {
30
- sum += parseFloat(array[key]);
26
+ sum += parseFloat(array[key])
31
27
  }
32
28
  }
33
29
 
34
- return sum;
35
- };
36
- //# sourceMappingURL=array_sum.js.map
30
+ return sum
31
+ }