Repository navigation
refactor(commons): Replace the _ utilities with standalone functions (v6) - #3724
Open
fratzinger wants to merge 1 commit into
Open
fratzinger wants to merge 1 commit into
fratzinger wants to merge 1 commit into
Conversation
…s (v6) `feathers/commons` exported a lodash-like `_` object. Feathers itself only used `_.pick` and most of the other helpers have native replacements (`Object.keys`, `Object.values`, `Object.assign`). The commons are now a folder of standalone, typed functions: - `feathers/commons` exports `isObject`, `pick`, `omit` and `stripSlashes` - Remove `_` (`each`, `some`, `every`, `keys`, `values`, `isMatch`, `isEmpty`, `isObjectOrArray`, `extend`, `merge`), `isPromise`, `createSymbol` and the debug re-export (still available from `feathers`) - `SERVICE` uses `Symbol.for()` directly (same value as before) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
feathers/commonsexported a lodash-like_object. Feathers itself only uses_.pick(once, in the fetch client) andstripSlashes. Most of the other helpers have native replacements. Even the v5 ecosystem (adapter-commons, knex, mongodb, schema, rest-client, oauth) only used_.omit,_.pickand_.isObject. The commons are now a folder of standalone, typed functions:feathers/commonsnow exports exactlyisObject,pick,omitandstripSlashes, in both the ESM and CJS builds._is removed, together withisPromise,createSymboland the debug re-export. The debug functions (createDebug,setDebug) are still exported fromfeathers.SERVICEnow usesSymbol.for('@feathersjs/service')directly instead ofcreateSymbol(). The value is the same.pickfound thattoErrorin the fetch client picksaddress,portandconfigfrom a value whose type has none of them, so those fields are now declared on its parameter type. TheECONNREFUSEDbranch there looks like a leftover from the axios/request clients, sincefetchrejects with aTypeErrorthat has acause. That is left for a follow-up.mergealso removes the code path that needed the prototype pollution fix in fix(feathers): skip prototype-polluting keys in _.merge #3689.Since there is no
_object any more, bundlers can tree-shake unused helpers.No related issues, and no dependencies on other PRs.
Evidence
Test Files 30 passed,Tests 497 passed | 1 skippedAfter:
Test Files 31 passed,Tests 484 passed | 1 skipped. The 17 tests for_,isPromiseandcreateSymbolare removed, and 4 tests forstripSlashes,isObject,pickandomitare added.npm testpasses on Node.js 24 and 26, and CI is green on 20.x and 24.x.Merge Danger
Door: two-way
Blast Radius: small
_,isPromiseorcreateSymbolfromfeathers/commonsin the v6 prereleases. Replacements for the migration guide:_.keys/_.values/_.extend→Object.keys/Object.values/Object.assign_.each/_.some/_.every→Object.entries()/Object.values().some()/.every()_.isEmpty(x)→Object.keys(x).length === 0_.merge→structuredCloneor a custom deep mergeisPromise(x)→typeof x?.then === 'function'createSymbol(name)→Symbol.for(name)commons.test.tsandclient/fetch.ts, and chore: Publish feathers as ESM only (v6) #3723, which edits the./commonsexport. Whichever PR is merged second needs a rebase.🤖 Generated with Claude Code