deepMerge(target, patch, isOverride)
deepMerge will modify target in place and return it.
+key and key+ act as array modifiers only if isOverride is true. The script recommends always passing in true.
deepMerge 示例.js
deepMerge 结果 diff.yaml
deepMerge does not automatically move the MATCH rule to the end; when you need this behavior, use YAML’s rules-end, or handle the array yourself in your script.
Incorrect or invalid usage:
deepMerge 无效类型.js
mixed-port is a scalar, and the array modifier will try to expand the original value; if the original value is a number, a non-iterable type error will usually be thrown. It does not convert ports to lists.
yaml
yaml.parse(text)
Convert YAML text to JavaScript values. It uses the same parser as the YAML override, supporting anchors, aliases, << merge keys, and reality-opts.short-id string protection in top-level proxies.
解析 YAML.js
解析 YAML 结果 diff.yaml
解析错误 YAML.js
yaml.stringify(value)
Convert JavaScript values to YAML strings.
生成 YAML.js
yaml.stringify is a string and cannot be directly used as the return value of main; a configuration object must be returned.
The output is similar to:
fetch(input, init)
The built-in fetch only supports http://, not https://. Connections, reads, and writes each have a 15-second timeout.
Request parameters
url, method, headers, and body in init overwrite the values of the same name in the input object.
HTTP 请求.js
Response object
读取 JSON.js
不支持 HTTPS.js
fetch only supports http:// urls. The script also stops when the network connection fails, the URL is empty, or the response cannot be parsed.
Non-2xx responses will not automatically throw an error and must be checked for response.ok:
检查 HTTP 状态.js
console
The log is written to the .log file in the same directory and with the same main file name as the currently overwritten file; the old log will be reset each time before executing the overwrite.
Multiple parameters are concatenated with spaces; objects are serialized to JSON.
日志 API.js
(redacted, encrypted profile).
Base64
b64e(value) and b64d(value)
b64e encodes UTF-8 text to Base64, and b64d decodes Base64 to UTF-8 text.
Base64 API.js
Buffer
Buffer API.js
utf8, utf-8 and base64 are supported. Other encodings throw Buffer.from() unsupported encoding or Buffer.toString() unsupported encoding.