Skip to content
Merged

Dev #17

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
node_modules
/build
*.tsbuildinfo
graphify-out
.claude

# environment variables
.env
.development.env
*.tsbuildinfo

# Logs
logs
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Changelog

### [v2.3.1](https://github.com/panates/jsopen-objects/compare/v2.3.0...v2.3.1) -
### [v2.3.3](https://github.com/panates/jsopen-objects/compare/v2.3.2...v2.3.3) -

#### 📖 Documentation Changes

- docs: add TSDoc to every exported function @Eray Hanoğlu
26 changes: 26 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## graphify

This project has a knowledge graph at graphify-out/ with god nodes, community structure, and cross-file relationships.

Rules:
- For codebase questions, first run `graphify query "<question>"` when graphify-out/graph.json exists. Use `graphify path "<A>" "<B>"` for relationships and `graphify explain "<concept>"` for focused concepts. These return a scoped subgraph, usually much smaller than GRAPH_REPORT.md or raw grep output.
- If graphify-out/wiki/index.md exists, use it for broad navigation instead of raw source browsing.
- Read graphify-out/GRAPH_REPORT.md only for broad architecture review or when query/path/explain do not surface enough context.
- After modifying code, run `graphify update .` to keep the graph current (AST-only, no API cost).


## API docs baseline (docs/api.md, docs/api/*.md)

`docs/api.md` starts with an HTML comment block (`docs-baseline`) recording the git commit,
package version, and date the API docs were last verified against source - see that block for
the exact format and the `git diff <commit>..HEAD -- src/` command it documents.

Rules:
- Whenever you write or update these API docs, record (or update) that baseline block with the
commit you verified against - so a later session can diff from a known point instead of
re-reading everything from scratch.
- Before trusting/updating the docs, diff `src/` (and `test/**/*.spec.ts` for examples) between
the recorded commit and `HEAD` to see what actually changed, then update only the affected
doc section(s) - don't regenerate everything unless the diff is broad enough to warrant it.
- After updating, bump `git-commit`/`package-version`/`date` in the baseline block to the new
`HEAD` (only once the docs are verified accurate as of that commit).
48 changes: 45 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,54 @@
[![CI Tests][ci-test-image]][ci-test-url]
[![Test Coverage][coveralls-image]][coveralls-url]

A 'swiss army knife' solution for working with javascript objects.
A 'swiss army knife' solution for working with JavaScript objects and arrays — deep merging,
cloning, omitting keys/nullish values, and a set of dependency-free type guards, all in one
small, fully-typed package.

## Functions
## Features

- **`merge`** — deep or shallow merging of objects/arrays, multiple sources, array merge
strategies (append/unique), property-descriptor cloning, custom filters, and built-in
prototype-pollution protection.
- **`clone` / `deepClone`** — copy objects and arrays (including class instances with
`deepClone`), with full support for top-level arrays as the value being cloned.
- **`omit` / `omitUndefined` / `omitNull` / `omitNullish`** — drop specific keys or
`null`/`undefined` values, shallow or deep, from objects or arrays.
- **Type guards** — `isObject`, `isPlainObject`, `isBuiltIn`, `isConstructor`, `isIterable`,
`isAsyncIterable` — none of them throw on unexpected input.
- **`updateErrorMessage`** — change an `Error`'s message and keep its stack trace header
consistent, without losing the original stack frames.
- Zero runtime dependencies, ESM-only, written in TypeScript.

## Quick Start

```typescript
import { merge, clone, deepClone, omit, omitUndefined } from '@jsopen/objects';

// Deep merge
merge({ a: 1 }, { b: 2 }, { deep: true });
// => { a: 1, b: 2 }

// Clone (objects or top-level arrays, deeply by default)
clone({ a: 1, b: { c: 2 } });
clone([1, 2, { x: 1 }]);

// Deep-clone including class instances
class Point { constructor(public x: number, public y: number) {} }
deepClone({ point: new Point(1, 2) });

// Exclude keys / nullish values
omit({ a: 1, b: 2, c: 3 }, ['b']); // => { a: 1, c: 3 }
omitUndefined({ a: 1, b: undefined }, true); // => { a: 1 }
```

## Documentation

See the [**Full API Reference**](docs/api.md) for every function, option, and edge case, or
jump to a focused guide:

### [merge](docs/merge.md)
Is a powerful, flexible tool for merging objects, arrays, and their nested properties.
A powerful, flexible tool for merging objects, arrays, and their nested properties.

### [clone / deepClone](docs/clone.md)
Easy ways to create shallow or deep copies of objects and arrays.
Expand Down
Loading