Skip to main content
JavaScript overrides run within YumeBox’s built-in JavaScript environment. The following APIs are complete global methods provided by the runtime.

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
JavaScript’s 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
Parsing invalid YAML will directly throw an error:
解析错误 YAML.js

yaml.stringify(value)

Convert JavaScript values to YAML strings.
生成 YAML.js
The result of 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
Error expected:
不支持 HTTPS.js
The script will fail with an error containing 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
The log results are similar:
When the encryption configuration script is executed, the configuration value in the log is replaced with (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
Expected results:

Buffer

Buffer API.js
Expected results:
Only utf8, utf-8 and base64 are supported. Other encodings throw Buffer.from() unsupported encoding or Buffer.toString() unsupported encoding.
Last modified on August 13, 2026