4
23
Fork
You've already forked jsdb
3

main #8

Closed
kote-isaev wants to merge 7 commits from kote-isaev/jsdb:main into main
pull from: kote-isaev/jsdb:main
merge into: small-tech:main
small-tech:main
small-tech:types
small-tech:set-support
small-tech:better-custom-objects
small-tech:typed-arrays
small-tech:cjs
First-time contributor
Copy link

Changes:

  1. Fixed how database path built from url, in more cross-platform way, to fix issue experienced under local development under Windows
  2. made log muting more testable and get console log muting tests working.
Changes: 1) Fixed how database path built from url, in more cross-platform way, to fix issue experienced under local development under Windows 2) made log muting more testable and get console log muting tests working.
Author
First-time contributor
Copy link

Added fix for assigning property to null and undefined.
Null work as expexted (property assigned to null and saved), assign to undefined works as delete property.

Added fix for assigning property to null and undefined. Null work as expexted (property assigned to null and saved), assign to undefined works as delete property.
Owner
Copy link

@kote-isaev Thanks again for this, Kote.

I’ve cherry-picked the Windows fix (I’d missed it in the tests – it’s an issue I’d previously raised with the Node folks @ https://github.com/nodejs/node/issues/37845 – thank you for catching this) and the null/undefined implementations.

For undefined, I went ahead and made it so that instead of deleting the record, it actually stores undefined. This is so that it behaves the same regardless of whether you’re setting undefined in an object when creating it or later.

So:

db.myTable.myObject = { a: undefined }

And

db.myTable.myObject = {}
db.myTable.myObject.a = undefined

Now produce the same result;

{ a: undefined }

Other than that, I wasn’t sure what the console.log changes improved regarding the unit tests so I’ve left them out for now. If there is a limitation I’m missing with those tests that your code improves, would you mind detailing it in an issue and I’ll reconsider.

Thanks again for contributing and helping make JSDB better; I really appreciate it :)

💕

@kote-isaev Thanks again for this, Kote. I’ve cherry-picked the Windows fix (I’d missed it in the tests – it’s an issue I’d previously raised with the Node folks @ https://github.com/nodejs/node/issues/37845 – thank you for catching this) and the null/undefined implementations. For undefined, I went ahead and made it so that instead of deleting the record, it actually stores `undefined`. This is so that it behaves the same regardless of whether you’re setting `undefined` in an object when creating it or later. So: ```js db.myTable.myObject = { a: undefined } ``` And ```js db.myTable.myObject = {} db.myTable.myObject.a = undefined ``` Now produce the same result; ```js { a: undefined } ``` Other than that, I wasn’t sure what the `console.log` changes improved regarding the unit tests so I’ve left them out for now. If there is a limitation I’m missing with those tests that your code improves, would you mind detailing it in an issue and I’ll reconsider. Thanks again for contributing and helping make JSDB better; I really appreciate it :) 💕
aral closed this pull request 2023年09月18日 15:09:40 +02:00
Owner
Copy link

The contents of this pull request have now been published in JSDB version 3.0.4.

Thanks again, @kote-isaev :)

The contents of this pull request have now been published in JSDB version 3.0.4. Thanks again, @kote-isaev :)
Author
First-time contributor
Copy link

Thanks for quick response and accepting my pull request.
Lets see how this update about undefined will settle. From JSDB point of view it is correct (to keep behavior of assignment consistent).
My motivation for deleting property instead was the fact that undefined values are being skipped during JSON serialization that happens e. g. during sending a JSDB record as part of response body, or if that record will be JSON-ed as part of "JSON cloning" of record.
For that it is better to use structuralClone if it available, but it seems I was a bit over-engineering this aspect, may be.

Thanks for quick response and accepting my pull request. Lets see how this update about `undefined` will settle. From JSDB point of view it is correct (to keep behavior of assignment consistent). My motivation for deleting property instead was the fact that `undefined` values are being skipped during JSON serialization that happens e. g. during sending a JSDB record as part of response body, or if that record will be JSON-ed as part of "JSON cloning" of record. For that it is better to use `structuralClone` if it available, but it seems I was a bit over-engineering this aspect, may be.

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
small-tech/jsdb!8
Reference in a new issue
small-tech/jsdb
No description provided.
Delete branch "kote-isaev/jsdb:main"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?