mapbox / mapbox/togeojson

Use another compound assignment statement

Open
#170 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.3k
Forks
322
PR merge metrics
No merged PRs in 30d

Description

👀 Some source code analysis tools can help to find opportunities for improving software components.
💭 I propose to increase the usage of compound operators accordingly.

diff --git a/togeojson.js b/togeojson.js
index 23ec6cc..f006622 100644
--- a/togeojson.js
+++ b/togeojson.js
@@ -136,7 +136,7 @@ var toGeoJSON = (function() {
             }
             function kmlColor(v) {
                 var color, opacity;
-                v = v || '';
+                v ||= '';
                 if (v.substr(0, 1) === '#') { v = v.substr(1); }
                 if (v.length === 6 || v.length === 3) { color = v; }
                 if (v.length === 8) {

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open togeojson.js and start at the kmlColor function, where the issue identifies the assignment to update. Replace the eligible fallback assignment with the proposed compound form and confirm that the existing color-processing behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data
Issue type
Refactor
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.