[
https://issues.apache.org/jira/browse/SLING-7688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16493516#comment-16493516
]
Radu Cotescu commented on SLING-7688:
-------------------------------------
Implemented in:
* [commit
079d8bb|https://github.com/apache/sling-org-apache-sling-scripting-sightly-compiler/commit/079d8bb]
* [commit
3fbe9dd|https://github.com/apache/sling-org-apache-sling-scripting-sightly-compiler-java/commit/3fbe9dd]
> [HTL] Add support for the in relational operator
> ------------------------------------------------
>
> Key: SLING-7688
> URL: https://issues.apache.org/jira/browse/SLING-7688
> Project: Sling
> Issue Type: Sub-task
> Components: Scripting
> Reporter: Radu Cotescu
> Assignee: Radu Cotescu
> Priority: Major
>
> According to [0], a new relational operator ({{in}}) has to be supported to
> comply with version 1.4 of the specification.
> {code:xml}
> ${'a' in 'abc'} <!--/* returns true */-->
> ${'ab' in 'abc'} <!--/* returns true */-->
> ${'bc' in 'abc'} <!--/* returns true */-->
> ${'abc' in 'abc'} <!--/* returns true */-->
> ${'d' in 'abc'} <!--/* returns false */-->
> <!--/*
> Assuming myArray would be in scope and would have the following content:
> [100, 200, 300, 400, 500]
> */-->
> ${100 in myArray} <!--/* returns true */-->
> ${300 in myArray} <!--/* returns true */-->
> ${1 in myArray} <!--/* returns false */-->
> <!--/*
> Assuming the following use object (more details in the Use-API section)
> provided by a `logic.js` file:
> use(function () {
> return {
> a: true,
> b: 'two',
> c: 3
> };
> });
> */-->
> <sly data-sly-use.logic="logic.js" />
> ${'a' in logic} <!--/* returns true */-->
> ${'b' in logic} <!--/* returns true */-->
> ${'c' in logic} <!--/* returns true */-->
> ${'two' in logic} <!--/* returns false */-->
> {code}
> [0] - [https://github.com/Adobe-Marketing-Cloud/htl-spec/issues/56]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)