-
-
Notifications
You must be signed in to change notification settings - Fork 0
BREAKING: Pure Chainable API - Remove All Old APIs - v2.0.0 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: axetroy <9758711+axetroy@users.noreply.github.com>
Co-authored-by: axetroy <9758711+axetroy@users.noreply.github.com>
Co-authored-by: axetroy <9758711+axetroy@users.noreply.github.com>
Co-authored-by: axetroy <9758711+axetroy@users.noreply.github.com>
Co-authored-by: axetroy <9758711+axetroy@users.noreply.github.com>
|
@copilot Could you combine formatValue and several other functions into a single function export? It seems to be redundant. |
Co-authored-by: axetroy <9758711+axetroy@users.noreply.github.com>
Done! Simplified to keep only Changes in commit 9aa665e:
|
|
@copilot fix the test |
Co-authored-by: axetroy <9758711+axetroy@users.noreply.github.com>
Fixed! The dist tests were failing because Changed to use regex assertions instead. All 90 tests now pass. Commit 2a1aaee:
|
…tions" This reverts commit 2a1aaee.
|
@copilot Please redesign the API. To use the class, you can chain calls, for example, Finally, call |
Co-authored-by: axetroy <9758711+axetroy@users.noreply.github.com>
Done! Implemented a complete API redesign with the chainable interface you requested. New API (commit b2c519a): import jsonmod from "json-codemod";
jsonmod(source)
.replace("user.name", '"Bob"')
.delete("user.age")
.insert("items", 0, '"newItem"')
.apply();Key features:
Backward compatibility: See CHAINABLE_API.md for complete documentation. |
|
@copilot We don't need the Backward compatibility, keep improve it. |
Co-authored-by: axetroy <9758711+axetroy@users.noreply.github.com>
Done! Removed all backward compatibility. The library now exports only the new chainable API. Changes (commit c057e16): ✅ Exports simplified:
❌ Removed:
Benefits:
New usage: import jsonmod from "json-codemod";
jsonmod(source)
.replace("name", '"Bob"')
.delete("age")
.apply();README completely rewritten to focus only on chainable API. |
API Redesign - v2.0.0 Pure Chainable API
This PR implements a complete API redesign with only the new chainable interface. All old functional APIs have been removed.
New Chainable API (Only API)
Single default export:
Benefits:
What's Exported
Default export:
jsonmod- Chainable API factory functionNamed exports:
jsonmod- Chainable API factory functionJsonMod- The class (for TypeScript)formatValue- Value helper functionWhat Was Removed
❌ Removed old functional APIs:
replace()- Usejsonmod().replace().apply()remove()- Usejsonmod().delete().apply()insert()- Usejsonmod().insert().apply()batch()- Use chainable methods❌ Removed code:
src/function/directory (8 files)Chainable Methods
.replace(path, value)- Replace a value.delete(path)/.remove(path)- Delete a property/element.insert(path, keyOrPosition, value)- Insert into object/array.apply()- Execute all operations and return resultValue Helper
formatValue()- Automatically formats JavaScript values to JSON strings:Testing
Documentation
Complete documentation rewritten for chainable API only:
Migration from v1.x
This is a major breaking change. All code must migrate to the chainable API:
Code Reduction
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.