Skip to content

Port deepMap logic and add new features - #1

Merged
Lifo123 merged 14 commits into
mainfrom
feature/Initialize-with-array
Nov 16, 2025
Merged

Port deepMap logic and add new features#1
Lifo123 merged 14 commits into
mainfrom
feature/Initialize-with-array

Conversation

@Lifo123

@Lifo123 Lifo123 commented Nov 14, 2025

Copy link
Copy Markdown
Member

Hi @ai,

Following our conversation in nanostores/nanostores#373, I've moved the deepMap logic into this new repository.

This branch includes the original logic:

I've added the new updateKey method. This allows merge new data with existing store values (e.g., for objects or arrays).

Also deepmap now accepts an array (e.g., deepMap([])) as a valid initial value. Let me know what you think!

@Lifo123
Lifo123 requested a review from ai November 14, 2025 22:26
Comment thread deep-map/deepmap.test.ts Outdated
type arr1 = Array<obj1>

const $storeObj1 = deepMap<obj1>({ f: 'initial' });
const $storeArr1 = deepMap<arr1>([{ h: true }]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange test. Is it your type tests?

Comment thread deep-map/deepmap.ts Outdated
}

return $deepmap
} No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend copying .editorconfig which will force ending newline to files (there is old tradition to have \n at the end of the files)

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated

const $store = deepMap({
count: 0,
type storeProps = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most of TS developers use capitalized names for types: StoreProps

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread index.js
@@ -1,9 +0,0 @@

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without index.js you exports will not be avaiable by import { … } from @nanostores/deepman``

@ai

ai commented Nov 15, 2025

Copy link
Copy Markdown
Member

You also need to fix CI

Lifo123 and others added 6 commits November 15, 2025 19:27
Co-authored-by: Andrey Sitnik <andrey@sitnik.ru>
Co-authored-by: Andrey Sitnik <andrey@sitnik.ru>
Co-authored-by: Andrey Sitnik <andrey@sitnik.ru>
Co-authored-by: Andrey Sitnik <andrey@sitnik.ru>
Comment thread package.json Outdated
"files": [
"dist"
],
"exports": "./dist/deep-map/index.ts",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can’t export .ts file. The content of node_modules must export only JS (Node.js’s strip types works only outside of node_modules)

Comment thread package.json Outdated
"test": "pnpm run /^test:/"
},
"author": "Andrey Sitnik <andrey@sitnik.ru>",
"author": "Edgar Sanchez",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend adding email here. It is rare to get spam from github/npm but it could be very useful for some security issues, etc.

Comment thread README.md Outdated
## Credits

* [Nanostores](https://github.com/nanostores/nanostores) - The original state manager. No newline at end of file
* [Nanostores](https://github.com/nanostores/nanostores) - The original state manager.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* [Nanostores](https://github.com/nanostores/nanostores) - The original state manager.
* [Nano Stores](https://github.com/nanostores/nanostores), the original state manager.

@ai

ai commented Nov 16, 2025

Copy link
Copy Markdown
Member

LGTM, let’s merge it.

Run npm publish --dry-run and check the files, which will be in npm package (remove dev files).

@ai

ai commented Nov 16, 2025

Copy link
Copy Markdown
Member

What is your npm user name?

@Lifo123

Lifo123 commented Nov 16, 2025

Copy link
Copy Markdown
Member Author

What is your npm user name?

My npm user is lifo123

@ai

ai commented Nov 16, 2025

Copy link
Copy Markdown
Member

I invited you to nanotores org on npm. Tell me when you will accept invite and release the first version, I will tune the access rights only to you.

@Lifo123
Lifo123 merged commit 186f9e2 into main Nov 16, 2025
4 checks passed
@Lifo123

Lifo123 commented Nov 16, 2025

Copy link
Copy Markdown
Member Author

All done. i publish v0.0.1
and apologies for making you review on sunday
Thanks for all the guidance!

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.

2 participants