mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-15 23:30:00 -04:00
pass in full scramjet config
This commit is contained in:
parent
c60645d478
commit
f0e8aed666
2 changed files with 10 additions and 12 deletions
|
@ -33,7 +33,11 @@ fn create_encode_function(encode: JsValue) -> EncodeFn {
|
|||
})
|
||||
}
|
||||
|
||||
fn get_str(config: &Object, k: &str) -> String {
|
||||
fn get_obj(config: &JsValue, k: &str) -> JsValue {
|
||||
Reflect::get(config, &k.into()).unwrap()
|
||||
}
|
||||
|
||||
fn get_str(config: &JsValue, k: &str) -> String {
|
||||
Reflect::get(config, &k.into())
|
||||
.unwrap()
|
||||
.as_string()
|
||||
|
@ -43,7 +47,7 @@ fn get_str(config: &Object, k: &str) -> String {
|
|||
fn get_config(config: Object) -> Config {
|
||||
Config {
|
||||
prefix: get_str(&config, "prefix"),
|
||||
encode: create_encode_function(Reflect::get(&config, &"encode".into()).unwrap()),
|
||||
encode: create_encode_function(get_obj(&get_obj(&config, "codec"), "encode")),
|
||||
wrapfn: get_str(&config, "wrapfn"),
|
||||
importfn: get_str(&config, "importfn"),
|
||||
rewritefn: get_str(&config, "rewritefn"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue