René's URL Explorer Experiment


Title: Conversions/RgbHslConversion: rgbToHsl mutates (and returns) its input array instead of a copy · Issue #1907 · TheAlgorithms/JavaScript · GitHub

Open Graph Title: Conversions/RgbHslConversion: rgbToHsl mutates (and returns) its input array instead of a copy · Issue #1907 · TheAlgorithms/JavaScript

X Title: Conversions/RgbHslConversion: rgbToHsl mutates (and returns) its input array instead of a copy · Issue #1907 · TheAlgorithms/JavaScript

Description: Description Conversions/RgbHslConversion.js::rgbToHsl mutates its input array. It aliases the argument with let colorHsl = colorRgb (no copy) and then overwrites colorHsl[0..2] in place, so the caller's RGB array is destroyed and replace...

Open Graph Description: Description Conversions/RgbHslConversion.js::rgbToHsl mutates its input array. It aliases the argument with let colorHsl = colorRgb (no copy) and then overwrites colorHsl[0..2] in place, so the cal...

X Description: Description Conversions/RgbHslConversion.js::rgbToHsl mutates its input array. It aliases the argument with let colorHsl = colorRgb (no copy) and then overwrites colorHsl[0..2] in place, so the cal...

Opengraph URL: https://github.com/TheAlgorithms/JavaScript/issues/1907

X: @github

direct link

Domain: Github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Conversions/RgbHslConversion: rgbToHsl mutates (and returns) its input array instead of a copy","articleBody":"**Description**\n\n`Conversions/RgbHslConversion.js::rgbToHsl` mutates its input array. It aliases the argument with `let colorHsl = colorRgb` (no copy) and then overwrites `colorHsl[0..2]` in place, so the caller's RGB array is destroyed and replaced with the HSL result.\n\n```js\nconst rgbToHsl = (colorRgb) =\u003e {\n  ...\n  let colorHsl = colorRgb        // \u003c- alias, NOT a copy\n  ...\n  colorHsl[0] = red / limit      // mutates caller's array\n  ...\n  colorHsl[0] = Math.round(hue)  // final HSL written back into the input array\n  colorHsl[1] = Math.round(saturation * 100)\n  colorHsl[2] = Math.round(luminance * 100)\n  return colorHsl\n}\n```\n\nThe returned value is the *same array object* as the input, so a caller that still needs its RGB values loses them.\n\n**To Reproduce** (verified with Node):\n\n```js\nconst input = [24, 98, 118]\nconst result = rgbToHsl(input)\n// result            -\u003e [193, 66, 28]   (correct HSL)\n// input             -\u003e [193, 66, 28]   \u003c- the caller's RGB array was overwritten\n// input === result  -\u003e true            \u003c- same object, not a copy\n```\n\n**Expected behavior**\n\n`rgbToHsl` returns a new HSL array and leaves the input RGB array unchanged (a conversion function should not have side effects on its argument).\n\n**Actual behavior**\n\nThe input array is mutated in place and is returned as the result (`input === result`), so the original RGB data is destroyed.\n\n**Suggested fix**\n\nWork on a copy instead of aliasing the input:\n\n```js\nlet colorHsl = [...colorRgb]\n```\n\nThe HSL math itself is correct; only the in-place mutation of the argument needs fixing.\n","author":{"url":"https://github.com/aimasteracc","@type":"Person","name":"aimasteracc"},"datePublished":"2026-06-18T02:21:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1907/JavaScript/issues/1907"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:0eceb651-6d1e-041c-a0ef-5ef1b57f4a21
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBBDC:32514C:462581:5EF1AB:6A627642
html-safe-nonce3968bccebb202622079b38cfafd7ccf4c62e9e0ec27853e539bc06d7e54959bf
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkRDOjMyNTE0Qzo0NjI1ODE6NUVGMUFCOjZBNjI3NjQyIiwidmlzaXRvcl9pZCI6Ijc5NTc5NTg2MTAzMzY3NzM2OTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac7674b902c39b615588eb346316ddf3749473d47603a2e012abb4388aaa35db7d
hovercard-subject-tagissue:4688584356
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/TheAlgorithms/JavaScript/1907/issue_layout
twitter:imagehttps://opengraph.githubassets.com/066f1780e1285a400634a5204dd3e2820e5894f63e97f0e2c190cd56d7872c37/TheAlgorithms/JavaScript/issues/1907
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/066f1780e1285a400634a5204dd3e2820e5894f63e97f0e2c190cd56d7872c37/TheAlgorithms/JavaScript/issues/1907
og:image:altDescription Conversions/RgbHslConversion.js::rgbToHsl mutates its input array. It aliases the argument with let colorHsl = colorRgb (no copy) and then overwrites colorHsl[0..2] in place, so the cal...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameaimasteracc
hostnamegithub.com
expected-hostnamegithub.com
None838e87bd0e4f5415707a930bc14e89e382dc2ea046e50ff575252eb2f2cb06a2
turbo-cache-controlno-preview
go-importgithub.com/TheAlgorithms/JavaScript git https://github.com/TheAlgorithms/JavaScript.git
octolytics-dimension-user_id20487725
octolytics-dimension-user_loginTheAlgorithms
octolytics-dimension-repository_id97086543
octolytics-dimension-repository_nwoTheAlgorithms/JavaScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id97086543
octolytics-dimension-repository_network_root_nwoTheAlgorithms/JavaScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef0081192f88523d2bf4cfdf22bb3e138affc4cd1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://Github.com/TheAlgorithms/JavaScript/issues/1907#start-of-content
https://Github.com/
Sign in https://Github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTheAlgorithms%2FJavaScript%2Fissues%2F1907
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://Github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTheAlgorithms%2FJavaScript%2Fissues%2F1907
Sign up https://Github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=TheAlgorithms%2FJavaScript
Reloadhttps://Github.com/TheAlgorithms/JavaScript/issues/1907
Reloadhttps://Github.com/TheAlgorithms/JavaScript/issues/1907
Reloadhttps://Github.com/TheAlgorithms/JavaScript/issues/1907
Please reload this pagehttps://Github.com/TheAlgorithms/JavaScript/issues/1907
TheAlgorithms https://Github.com/TheAlgorithms
JavaScripthttps://Github.com/TheAlgorithms/JavaScript
Please reload this pagehttps://Github.com/TheAlgorithms/JavaScript/issues/1907
Notifications https://Github.com/login?return_to=%2FTheAlgorithms%2FJavaScript
Fork 5.9k https://Github.com/login?return_to=%2FTheAlgorithms%2FJavaScript
Star 34.2k https://Github.com/login?return_to=%2FTheAlgorithms%2FJavaScript
Code https://Github.com/TheAlgorithms/JavaScript
Issues 21 https://Github.com/TheAlgorithms/JavaScript/issues
Pull requests 188 https://Github.com/TheAlgorithms/JavaScript/pulls
Actions https://Github.com/TheAlgorithms/JavaScript/actions
Projects https://Github.com/TheAlgorithms/JavaScript/projects
Wiki https://Github.com/TheAlgorithms/JavaScript/wiki
Security and quality 0 https://Github.com/TheAlgorithms/JavaScript/security
Insights https://Github.com/TheAlgorithms/JavaScript/pulse
Code https://Github.com/TheAlgorithms/JavaScript
Issues https://Github.com/TheAlgorithms/JavaScript/issues
Pull requests https://Github.com/TheAlgorithms/JavaScript/pulls
Actions https://Github.com/TheAlgorithms/JavaScript/actions
Projects https://Github.com/TheAlgorithms/JavaScript/projects
Wiki https://Github.com/TheAlgorithms/JavaScript/wiki
Security and quality https://Github.com/TheAlgorithms/JavaScript/security
Insights https://Github.com/TheAlgorithms/JavaScript/pulse
#1908https://github.com/TheAlgorithms/JavaScript/pull/1908
Conversions/RgbHslConversion: rgbToHsl mutates (and returns) its input array instead of a copyhttps://Github.com/TheAlgorithms/JavaScript/issues/1907#top
#1908https://github.com/TheAlgorithms/JavaScript/pull/1908
https://github.com/aimasteracc
aimasteracchttps://github.com/aimasteracc
on Jun 18, 2026https://github.com/TheAlgorithms/JavaScript/issues/1907#issue-4688584356
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.