chore: remove underscore, replace with native JS; drop reactfire#38
Merged
Merged
Conversation
Copilot created this pull request from a session on behalf of
ProLoser
June 12, 2026 22:41
View session
There was a problem hiding this comment.
Pull request overview
This PR removes the underscore dependency by replacing its usages with native JavaScript equivalents, and drops the unused reactfire npm dependency to resolve peer dependency conflicts during installation.
Changes:
- Replaced
underscorehelpers inscript.jsxandapp.jswith native JS (Object.keys/values/entries,Array.from().find(),Set-based dedupe). - Removed
underscore(and its CDN/cache entries) and removedreactfirefrompackage.json. - Regenerated
yarn.lockto reflect dependency graph changes.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updated lockfile reflecting removal of underscore/reactfire and related resolution churn. |
| script.jsx | Replaced underscore iteration/query utilities with native JS equivalents. |
| app.js | Replaced underscore usage in paste handling and uniqueness filtering with native JS. |
| package.json | Removed underscore and reactfire from dependencies. |
| index.html | Removed the underscore CDN script tag. |
| cache.manifest | Removed the underscore CDN entry from the app cache manifest. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
414
to
418
| // Strip formatting on paste | ||
| var tempDiv = document.createElement("DIV"); | ||
| var item = _.findWhere(e.clipboardData.items, { type: 'text/plain' }); | ||
| var item = Array.from(e.clipboardData.items).find(function(i) { return i.type === 'text/plain'; }); | ||
| item.getAsString(function (value) { | ||
| tempDiv.innerHTML = value; |
Comment on lines
261
to
266
| // Strip formatting on paste | ||
| var pasteBinding = $element.on('paste', function (e) { | ||
| var tempDiv = document.createElement("DIV"); | ||
| var item = _.findWhere(e.clipboardData.items, { type: 'text/plain' }); | ||
| var item = Array.from(e.clipboardData.items).find(function(i) { return i.type === 'text/plain'; }); | ||
| item.getAsString(function (value) { | ||
| tempDiv.innerHTML = value; |
Comment on lines
322
to
+326
| app.filter('unique', function(){ | ||
| return function(data){ | ||
| return _.uniq(data, false, function(row){ | ||
| return row && row.text && row.text.toUpperCase(); | ||
| var seen = new Set(); | ||
| return data.filter(function(row) { | ||
| var key = row && row.text && row.text.toUpperCase(); |
Comment on lines
7
to
10
| <!-- Libraries loaded from CDN --> | ||
| <script src="https://cdn.jsdelivr.net/npm/underscore@1.13.7/underscore-min.js"></script> | ||
| <script src="https://cdn.jsdelivr.net/npm/react@0.12.2/dist/react-with-addons.min.js"></script> | ||
| <script src="https://cdn.firebase.com/js/client/1.1.3/firebase.js"></script> | ||
| <script src="https://cdn.jsdelivr.net/npm/reactfire@0.4.0/dist/reactfire.min.js"></script> |
| var previous, previousIndex; | ||
| fb.update({firstLine: '0'}); | ||
| _.each(snapshot.val().lines, function(line, index) { | ||
| Object.entries(snapshot.val().lines).forEach(function([index, line]) { |
|
|
||
| window.onunload = (function(){ | ||
| if (_.keys(this.state.script.lines).length <= 2) | ||
| if (Object.keys(this.state.script.lines).length <= 2) |
| return character && character.toUpperCase(); | ||
| })), function(character){ | ||
| [...new Set( | ||
| Object.values(this.state.script.lines) |
Owner
|
@copilot address the review feedback in a new PR off of the latest main or master branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the
underscorelibrary and replaces all usages with native evergreen JS equivalents. Also removesreactfirewhich was causing a peer dependency conflict and was not imported anywhere in the codebase.Changes
package.jsonunderscorefrom dependenciesreactfirefrom dependencies (not used in source, was causingfirebasepeer dep conflict blockingnpm install)script.jsx_.each(obj, fn)→Object.entries(obj).forEach(fn)_.keys(obj).length→Object.keys(obj).length_.findWhere(items, {type})→Array.from(items).find()_.each(_.uniq(_.map(_.pluck(_.where(...)))))chain →Object.values().filter().map()+new Set()+.forEach()app.js_.findWhere→Array.from().find()_.uniq→Set-based deduplicationindex.html<script>tagcache.manifestTesting
All 62 existing tests pass.