huggingface.js
huggingface.js copied to clipboard
Add dictsort filter to @huggingface/jinja
- [x] Understand the dictsort filter specification from Jinja docs
- [x] Implement the dictsort filter in runtime.ts for ObjectValue
- [x] Add tests for dictsort filter with various parameters
- [x] Test the implementation with edge cases
- [x] Run lint and build to ensure code quality
- [x] Refactor to eliminate code duplication by extracting helper method
- [x] Improve null/undefined handling in sort comparisons
- [x] Add documentation for type handling assumptions
- [x] Move dictsort logic to ObjectValue builtins as FunctionValue per @xenova's feedback
- [x] Extract index calculation to avoid duplication
Original prompt
On jinja, Add support for the
dictsort. jinja filter to @huggingface/jinja package. Here are the docs for the feature: https://jinja.palletsprojects.com/en/stable/templates/#jinja-filters.dictsort
💡 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.