wrap() mutates bemjson which can lead to error for second run for same input data
- Dominant language
- JavaScript
- Stars
- 117
- Forks
- 48
- PR merge metrics
- No merged PRs in 30d
Description
### Input code or something about issue background
```js
const bemhtml = require('bem-xjst').bemhtml;
const tmpl = bemhtml.compile(function() {
block('b1').wrap()(node => ({
block: 'b2',
content: node.ctx
}));
});
const bemjson = { block: 'b1' };
const firstTime = tmpl.apply(bemjson);
const secondTime = tmpl.apply(bemjson);
console.log('firstTime:', firstTime);
console.log('secondTime:', secondTime);
```
**Important!**
1. bemjson should be passed by reference
2. the same instance of compiled template should be used
### Expected Behavior
```html
firstTime:
secondTime:
```
### Actual Behavior
```html
firstTime:
secondTime:
```
### Your Environment
Any version of `bem-xjst` with `wrap()` support.
// cc @vithar
Contributor guide
Assessment
This issue has not been assessed yet.