GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor(commons): Replace the `_` utilities with standalone functions (v6) by fratzinger · Pull Request #3724 · feathersjs/feathers

Conversation

@fratzinger

@fratzinger fratzinger commented Oct 22, 2026

Copy link
Copy Markdown
Member

Summary

feathers/commons exported a lodash-like _ object. Feathers itself only uses _.pick (once, in the fetch client) and stripSlashes. Most of the other helpers have native replacements. Even the v5 ecosystem (adapter-commons, knex, mongodb, schema, rest-client, oauth) only used _.omit, _.pick and _.isObject. The commons are now a folder of standalone, typed functions:

 packages/feathers/src/
-├── commons.ts          # _ { each, some, every, keys, values, isMatch, isEmpty, isObject,
-│                       #     isObjectOrArray, extend, omit, pick, merge }, stripSlashes,
-│                       #     isPromise, createSymbol, export * from './debug.js'
-├── commons.test.ts
+└── commons/
+    ├── index.ts
+    ├── object.ts       # isObject, pick, omit (typed with generics)
+    ├── object.test.ts
+    ├── path.ts         # stripSlashes
+    └── path.test.ts
  • feathers/commons now exports exactly isObject, pick, omit and stripSlashes, in both the ESM and CJS builds.
  • _ is removed, together with isPromise, createSymbol and the debug re-export. The debug functions (createDebug, setDebug) are still exported from feathers.
  • SERVICE now uses Symbol.for('@feathersjs/service') directly instead of createSymbol(). The value is the same.
  • The typed pick found that toError in the fetch client picks address, port and config from a value whose type has none of them, so those fields are now declared on its parameter type. The ECONNREFUSED branch there looks like a leftover from the axios/request clients, since fetch rejects with a TypeError that has a cause. That is left for a follow-up.
  • Dropping merge also 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

import * as c from 'feathers/commons'   ->  isObject, omit, pick, stripSlashes
require('feathers/commons')             ->  isObject, omit, pick, stripSlashes
SERVICE === Symbol.for('@feathersjs/service')  ->  true
  • Before: Test Files 30 passed, Tests 497 passed | 1 skipped
    After: Test Files 31 passed, Tests 484 passed | 1 skipped. The 17 tests for _, isPromise and createSymbol are removed, and 4 tests for stripSlashes, isObject, pick and omit are added. npm test passes on Node.js 24 and 26, and CI is green on 20.x and 24.x.

Merge Danger

Door: two-way

Blast Radius: small

  • This is a breaking change for anyone using _, isPromise or createSymbol from feathers/commons in 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 → structuredClone or a custom deep merge
    • isPromise(x) → typeof x?.then === 'function'
    • createSymbol(name) → Symbol.for(name)
  • There are small conflicts with chore: Migrate to ESLint 10 flat config with @feathers-community/eslint-config (v6) #3721, which edits commons.test.ts and client/fetch.ts, and chore: Publish feathers as ESM only (v6) #3723, which edits the ./commons export. Whichever PR is merged second needs a rebase.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@fratzinger @claude
refactor(commons): Replace the _ utilities with standalone function…
554e33d
…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 <[email protected]>
@fratzinger
fratzinger requested a review from daffl October 22, 2026 06:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@daffl daffl Awaiting requested review from daffl

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@fratzinger
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.