Visitar URL original
feat(helpers): expose generic object/path helpers as `feathers-utils/helpers` by fratzinger · Pull Request #80 · feathersjs/feathers-utils · GitHub
Skip to content

feat(helpers): expose generic object/path helpers as feathers-utils/helpers - #80

Merged
fratzinger merged 1 commit into
mainfrom
feat/helpers-entrypoint
Oct 20, 2026
Merged

fratzinger merged 1 commit into
mainfrom
feat/helpers-entrypoint

Conversation

@fratzinger

Copy link
Copy Markdown
Member

Adds a new entrypoint, feathers-utils/helpers, with the generic object and path helpers that so far were internal (src/common):

getPath · hasPath · setPath · pickPaths · omitPaths · isEqual · isPlainObject · isEmptyObject · isPromise · toArray

The goal is to let packages built on feathers-utils (feathers-casl first) drop their lodash dependency.

Changes

  • The helpers move to src/helpers/<name>/<name>.helper.ts and follow the usual feature-folder layout (implementation, .test.ts with a does not mutate test, .md). The in-source tests became regular test files.
  • src/common/index.ts re-exports the helpers, so internal imports are unchanged. The helpers import their sibling files directly, not through common/index.js, which would create an import cycle.
  • New ./helpers package export and tsdown entry. It is not in the root barrel, because these helpers aren't Feathers-specific.
  • Docs: new helpers category with sidebar, nav, overview table, chip color and an overview.md section. Each page has a "Coming from lodash" section that lists how the helper differs from its lodash counterpart.
  • CLAUDE.md and test/index.test.ts updated for the new entrypoint.

Behavior change

isEmptyObject now returns true only for plain objects, which is what its docs already said. Before, a class instance without own keys also counted as empty, so isEmptyObject(new Date()) was true. Internally the function only sees query objects, and all tests still pass.

Notes

  • setPath keeps its current semantics: it writes into target itself and shallow-copies every object below it on the path. This is what hooks need: setPath(context, 'params.query.x', v) leaves the caller's params untouched. setPathInPlace stays internal.

Verification

  • pnpm test passes (lint, typecheck, coverage at 98% of lines).
  • pnpm build produces dist/helpers.mjs.
  • pnpm docs:build renders all 10 pages under /helpers/.

🤖 Generated with Claude Code

…helpers`

Moves getPath, hasPath, setPath, pickPaths, omitPaths, isEqual,
isPlainObject, isEmptyObject, isPromise and toArray from `src/common` into
`src/helpers` feature folders and publishes them as a new `./helpers`
entrypoint (not part of the root barrel). `src/common` re-exports them, so
internal imports stay the same.

Each helper gets a docs page with notes on how it differs from lodash, and
the docs get a new `helpers` category.

`isEmptyObject` is now `true` only for plain objects, as its docs already
said; class instances without own keys (e.g. a `Date`) are `false`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying feathers-utils with  Cloudflare Pages  Cloudflare Pages

Latest commit: fdeb5e0
Status: ✅  Deploy successful!
Preview URL: https://9a126ad0.feathers-utils.pages.dev
Branch Preview URL: https://feat-helpers-entrypoint.feathers-utils.pages.dev

View logs

@fratzinger
fratzinger merged commit 17f6cec into main Oct 20, 2026
9 checks passed
@fratzinger
fratzinger deleted the feat/helpers-entrypoint branch October 20, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant