Skip to content

Commit dae54c8

Browse files
committed
Added is_type function
Ticket: CFE-3641 Signed-off-by: Victor Moene <victor.moene@northern.tech>
1 parent cd15d1d commit dae54c8

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

reference/functions/is_type.markdown

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
layout: default
3+
title: type
4+
published: true
5+
---
6+
7+
[%CFEngine_function_prototype(var, type)%]
8+
9+
**Description:** Returns whether a variable `var` is of type `type`
10+
11+
[%CFEngine_function_attributes(var, type)%]
12+
13+
This function compares the type description of `var` with the string `type`. The function expects a variable identifier as the first argument and a type string as the second argument. The type accepts both the type and an optional subtype. The function evaluates to false by default if the variable or the type string is wrong.
14+
15+
To see the possible data types and their subtypes, see `type()`
16+
17+
**Example:**
18+
19+
[%CFEngine_include_snippet(is_type.cf, #\+begin_src cfengine3, .*end_src)%]
20+
21+
Output:
22+
23+
[%CFEngine_include_snippet(is_type.cf, #\+begin_src\s+example_output\s*, .*end_src)%]
24+
25+
**History:**
26+
27+
* Introduced in 3.26.0

0 commit comments

Comments
 (0)