mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-07 05:25:39 +08:00
编排添加类型判断
This commit is contained in:
parent
4cd05732a9
commit
aff275fa7f
@ -4,6 +4,7 @@ const zlib = require("./zlib");
|
||||
const { htmlParser } = require("./htmlParser");
|
||||
const array = require("./array");
|
||||
const object = require("./object");
|
||||
const type = require("./type");
|
||||
const time = require("./time");
|
||||
const { regexTransform } = require("./regexTransform");
|
||||
|
||||
@ -15,5 +16,6 @@ module.exports = {
|
||||
array,
|
||||
object,
|
||||
time,
|
||||
type,
|
||||
regexTransform,
|
||||
};
|
||||
|
12
plugin/lib/quickcomposer/data/type.js
Normal file
12
plugin/lib/quickcomposer/data/type.js
Normal file
@ -0,0 +1,12 @@
|
||||
const get = (value) => {
|
||||
return typeof value;
|
||||
};
|
||||
|
||||
const check = (value, type) => {
|
||||
return typeof value === type;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
get,
|
||||
check,
|
||||
};
|
@ -5,6 +5,60 @@ export const dataCommands = {
|
||||
icon: "format_color_text",
|
||||
defaultOpened: false,
|
||||
commands: [
|
||||
{
|
||||
value: "typeof",
|
||||
label: "类型检查",
|
||||
icon: "check_circle",
|
||||
subCommands: [
|
||||
{
|
||||
value: "quickcomposer.data.type.get",
|
||||
label: "获取类型",
|
||||
icon: "text_fields",
|
||||
outputs: {
|
||||
label: "类型",
|
||||
suggestName: "valueType",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.type.check",
|
||||
label: "判断类型",
|
||||
icon: "text_fields",
|
||||
config: [
|
||||
{
|
||||
component: "QSelect",
|
||||
icon: "text_fields",
|
||||
options: [
|
||||
{ label: "字符串", value: "string" },
|
||||
{ label: "数字", value: "number" },
|
||||
{ label: "布尔", value: "boolean" },
|
||||
{ label: "数组", value: "array" },
|
||||
{ label: "对象", value: "object" },
|
||||
{ label: "函数", value: "function" },
|
||||
{ label: "空", value: "null" },
|
||||
{ label: "未定义", value: "undefined" },
|
||||
{ label: "Buffer", value: "buffer" },
|
||||
],
|
||||
width: 12,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "判断结果",
|
||||
suggestName: "isType",
|
||||
typeName: "布尔",
|
||||
},
|
||||
},
|
||||
],
|
||||
config: [
|
||||
{
|
||||
label: "要检查的值",
|
||||
component: "VariableInput",
|
||||
defaultValue: newVarInputVal("var"),
|
||||
icon: "text_fields",
|
||||
width: 12,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.reverse",
|
||||
label: "字符串处理",
|
||||
|
Loading…
x
Reference in New Issue
Block a user