bump: version 4.0.5-indev

This commit is contained in:
Asaki Yuki 2026-02-13 23:12:57 +07:00
parent ab83b33725
commit 1d00af88c0
2 changed files with 30 additions and 4 deletions

View file

@ -1,6 +1,6 @@
{
"name": "asajs",
"version": "4.0.4-preview",
"version": "4.0.5-indev",
"description": "Create your Minecraft JSON-UI resource packs using JavaScript",
"keywords": [
"Minecraft",

View file

@ -68,6 +68,10 @@ export const defaultFunctions = {
return {
genBindings: [
{
source: `(${input} < 0)`,
target: isNegative,
},
{
source: `(${input} < 2)`,
target: isLowerThanTwo,
@ -109,9 +113,30 @@ export const defaultFunctions = {
}
},
// str_length: str => {
// if (!/\#\w+/.test(str)) throw new Error("Invalid string")
// }
strlen: str => {
if (!/\#\w+/.test(str)) throw new Error("Invalid string")
const count = RandomBindingString()
const inputStr = RandomBindingString()
return {
genBindings: [
{
source: `0 * (${str} = 'a')`,
target: count,
},
{
source: `'a' + ${str}`,
target: inputStr,
},
{
source: `${count} + (not ((('%.' + (${count} + 1) + 's') * ${inputStr}) = ${inputStr}))`,
target: count,
},
],
value: count,
}
},
/**
* Return a translatable string
@ -120,6 +145,7 @@ export const defaultFunctions = {
*/
translatable: key => {
return {
genBindings: [],
value: `'%' + ${key}`,
}
},