ferrijs-std 0.2.3

Node and web standard library for the ferrijs QuickJS runtime: WHATWG Streams, Events, AbortController, Buffer, crypto, fs, os, url, zlib and the capability model they enforce (partly derived from awslabs/llrt, Apache-2.0).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use rquickjs::{Ctx, Result};

pub trait CtxExt {
    fn get_script_or_module_name(&self) -> Result<String>;
}

impl CtxExt for Ctx<'_> {
    fn get_script_or_module_name(&self) -> Result<String> {
        if let Some(name) = self.script_or_module_name(0) {
            name.to_string()
        } else {
            Ok(String::from("."))
        }
    }
}