LiteNode 4.7.0 Release Notes
🎉 What's New
Enhanced Template Engine Parsing
-
Fixed
@index,@keyandthisin expressions: You can now use loop context variables in conditional expressions{{#each posts}} {{#if @index > 0}} <!-- This now works! --> {{/if}} {{/each}} -
Fixed
#setin#eachloops: Variable assignment now works properly inside loop contexts{{#each items}} {{#set itemId = @index}} {{#set processedName = this.name | uppercase}} {{/each}}
New Array Manipulation Filters
Four powerful new filters for advanced array operations:
🔪 slice - Extract array portions
{{items | slice(1, 4)}} <!-- Get items 1-3 -->
{{items | slice(-3)}} <!-- Get last 3 items -->📥 take - Get first or last N items
{{posts | take(5)}} <!-- First 5 posts -->
{{comments | take(-3)}} <!-- Last 3 comments -->⏭️ skip - Skip first or last N items
{{items | skip(2)}} <!-- Skip first 2 -->
{{data | skip(-1)}} <!-- Skip last item -->📦 chunk - Split arrays into groups
{{#set rows = products | chunk(3)}}
{{#each rows}}
<div class="grid-row">
{{#each this}}
<div class="product">{{this.name}}</div>
{{/each}}
</div>
{{/each}}🚀 Use Cases
Pagination Made Easy
{{#set pageItems = allItems | slice(startIndex, endIndex)}}
{{#set hasMore = allItems | length > endIndex}}Grid Layouts
{{#set productRows = products | chunk(4)}}
{{#each productRows}}
<div class="product-row">
{{#each this}}
<div class="product-card">{{this.name}}</div>
{{/each}}
</div>
{{/each}}Featured Content
{{#set featured = posts | take(3)}}
{{#set recent = posts | take(-5)}}
{{#set regular = posts | skip(1)}}⚡ Performance Notes
- High Performance:
slice,take,skip,chunkare optimized for large arrays - Efficient Chaining: Combine filters for complex operations
- Memory Conscious: All new filters create shallow copies with minimal overhead
🛠️ Breaking Changes
None! This release is fully backward compatible.
📚 Documentation
Updated filters documentation with comprehensive examples and performance guidelines.
🔧 Bug Fixes
- Fixed template parsing errors when using
@index/@key/thisin expressions - Resolved
#setstatement parsing issues inside#eachloops - Improved error messages for invalid filter usage
Upgrade Command:
npm install litenode@4.7.0Full Changelog: v4.6.0...v4.7.0