lowdefy/packages/docs/operators/_or.yaml
2021-01-22 16:56:22 +02:00

81 lines
2.0 KiB
YAML

# Copyright 2020-2021 Lowdefy, Inc
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
_ref:
path: templates/operators.yaml.njk
vars:
pageId: _or
pageTitle: _or
types: |
```
(values: any[]): boolean
```
description: |
The `_or` operator performs a logical `or` over an array of inputs, using javascript [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) and [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) rules.
It returns true if any of the values in the array are truthy (not `false`, `0`, `null`, `undefined`, or the empty string `""`). If all the values are falsy, it returns `false`.
arguments: |
#### array
An array of values over which to perform a logical or.
examples: |
#### `true` and `false` values:
```yaml
_or:
- true
- false
```
Returns: `true`
#### Array of `true` and `false` values:
```yaml
_or:
- true
- false
- false
- false
```
Returns: `true`
#### Falsy values values:
```
```yaml
_or:
- null
- 0
- ''
```
Returns: `false`
#### Truthy values:
```yaml
_or:
- false
- "Hello"
```
Returns: `true`
```yaml
_or:
- false
- 99
```
Returns: `true`
```yaml
_or:
- false
- [1,2,3]
```
Returns: `true`