Skip to content

Commit

Permalink
fix(rule): adapt map_size and is_empty funcs in rule
Browse files Browse the repository at this point in the history
  • Loading branch information
ysfscream authored and Kinplemelon committed Dec 17, 2024
1 parent 7ccc0b0 commit 8750521
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/hooks/Rule/RuleFunc.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,16 @@
"required": true
}
]
},
{
"name": "is_empty",
"args": [
{
"name": "Value",
"type": "any",
"required": true
}
]
}
]
},
Expand Down Expand Up @@ -756,6 +766,16 @@
"required": true
}
]
},
{
"name": "map_size",
"args": [
{
"name": "Map",
"type": "object",
"required": true
}
]
}
]
},
Expand Down
24 changes: 24 additions & 0 deletions src/i18n/RuleSyntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -1164,4 +1164,28 @@ Typical JQ programs describe simple transformations or filters for JSON data, bu
zh: '返回值为执行生成生成的 JSON 对象列表。如果执行超时或者 JQ 程序抛出异常,该函数将抛出异常。',
en: 'list of objects corresponding to the JSON objects generated by the given JQ program (parameter 1) when given the input provided by parameter 2. The function throws an exception if the execution did not finish before the timeout or if the jq program throws an exception.',
},
isEmptyDesc: {
zh: '判断 Map 或数组是否为空',
en: 'Return true if the map or array is empty',
},
isEmptyParams: {
zh: '要检查的值',
en: 'Value to check',
},
isEmptyReturns: {
zh: '布尔值,为空时返回 true',
en: 'Boolean value, true if empty',
},
mapSizeDesc: {
zh: '获取 Map 的大小',
en: 'Return the size of a map',
},
mapSizeParams: {
zh: 'Map 对象',
en: 'Map object',
},
mapSizeReturns: {
zh: 'Map 的大小',
en: 'The size of the map',
},
}

0 comments on commit 8750521

Please sign in to comment.