nostrscript: add a helper function

This commit is contained in:
William Casarin
2023-07-03 16:59:50 -07:00
parent a6cbf50def
commit 30e33a01c1
9 changed files with 98 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
import * as nostr from './nostr'
export function go(): i32 {
var setting = "mny`or"
var new_setting = ""
for (let i = 0; i < setting.length; i++) {
new_setting += String.fromCharCode(setting.charCodeAt(i) + 1);
}
// this should fail
if (nostr.set_bool_setting("shmorg", true)) {
// you shouldn't be able to set settings that dont exist
return 0;
}
return nostr.set_bool_setting(new_setting, false)
}
go()