-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(remap): docs for the Remap type functions (#6446)
Co-authored-by: binarylogic <[email protected]>
- Loading branch information
1 parent
d21631c
commit 3f1c5b8
Showing
33 changed files
with
347 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package metadata | ||
|
||
remap: functions: array: { | ||
category: "Type" | ||
description: """ | ||
Errors if `value` is not an array, if `value` is an array it is returned. | ||
This allows the type checker to guarantee that the returned value is an array and can be used in any function | ||
that expects this type. | ||
""" | ||
|
||
arguments: [ | ||
{ | ||
name: "value" | ||
description: "The value to ensure is an array." | ||
required: true | ||
type: ["any"] | ||
}, | ||
] | ||
internal_failure_reasons: [ | ||
"`value` is not an array.", | ||
] | ||
return: types: ["array"] | ||
examples: [ | ||
{ | ||
title: "Declare an array type" | ||
input: log: value: [1, 2, 3] | ||
source: #""" | ||
array(.value) | ||
"""# | ||
return: input.log.value | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package metadata | ||
|
||
remap: functions: bool: { | ||
category: "Type" | ||
description: """ | ||
Errors if `value` is not a boolean, if `value` is a boolean it is returned. | ||
This allows the type checker to guarantee that the returned value is a boolean and can be used in any function | ||
that expects this type. | ||
""" | ||
|
||
arguments: [ | ||
{ | ||
name: "value" | ||
description: "The value to ensure is a boolean." | ||
required: true | ||
type: ["any"] | ||
}, | ||
] | ||
internal_failure_reasons: [ | ||
"`value` is not a boolean.", | ||
] | ||
return: { | ||
types: ["boolean"] | ||
rules: [ | ||
#"If `value` is a boolean then it is returned."#, | ||
#"Otherwise an error is raised."#, | ||
] | ||
} | ||
examples: [ | ||
{ | ||
title: "Declare a boolean type" | ||
input: log: value: false | ||
source: #""" | ||
bool(.value) | ||
"""# | ||
return: input.log.value | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package metadata | ||
|
||
remap: functions: float: { | ||
category: "Type" | ||
description: """ | ||
Errors if `value` is not a float, if `value` is a float it is returned. | ||
This allows the type checker to guarantee that the returned value is a float and can be used in any function | ||
that expects this type. | ||
""" | ||
|
||
arguments: [ | ||
{ | ||
name: "value" | ||
description: "The value to ensure is a float." | ||
required: true | ||
type: ["any"] | ||
}, | ||
] | ||
internal_failure_reasons: [ | ||
"`value` is not a float.", | ||
] | ||
return: { | ||
types: ["float"] | ||
rules: [ | ||
#"If `value` is an float then it is returned."#, | ||
#"Otherwise an error is raised."#, | ||
] | ||
} | ||
examples: [ | ||
{ | ||
title: "Delcare a float type" | ||
input: log: value: 42 | ||
source: #""" | ||
float(.radius) | ||
"""# | ||
return: input.log.value | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package metadata | ||
|
||
remap: functions: int: { | ||
category: "Type" | ||
description: """ | ||
Errors if `value` is not an integer, if `value` is an integer it is returned. | ||
This allows the type checker to guarantee that the returned value is an integer and can be used in any function | ||
that expects this type. | ||
""" | ||
|
||
arguments: [ | ||
{ | ||
name: "value" | ||
description: "The value to ensure is an integer." | ||
required: true | ||
type: ["any"] | ||
}, | ||
] | ||
internal_failure_reasons: [ | ||
"`value` is not an integer.", | ||
] | ||
return: types: ["integer"] | ||
examples: [ | ||
{ | ||
title: "Declare an integer type" | ||
input: log: value: 42 | ||
source: #""" | ||
int(.value) | ||
"""# | ||
return: input.log.value | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.