Helper to check property existence in ctx and in this
- Dominant language
- JavaScript
- Stars
- 117
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
Something like:
``` js
block('b42').match(function() { return this.ctx.icon; }).tag()('b')
// →
block('b42').has('icon').tag()('img')
```
and maybe like (or params/guards?):
``` js
block('b43').mod('flagged', 'yes')(function() {
this._icon = true;
return applyNext();
});
block('b42').match(function() { return this._icon; }).tag()('b')
// →
block('b43').mod('flagged', 'yes')(node => (node.flag('icon', true), applyNext()));
block('b42').hasFlag('icon').tag()('img');
```
And if we need negation (in addition to #246):
``` js
block('b42').match(function() { return !this.ctx.content; }).content()('default content');
block('b42').not(has('content')).content()('default content');
```
Contributor guide
Research direction
Start by reviewing the existing match(), mod(), ctx, and flag behavior described in the examples, along with the related issue #246. Done would require an agreed helper syntax and semantics for checking properties or flags on ctx and this, including the proposed negation form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100