Skip to content

Commit

Permalink
Removed *_with_* messages from DaterWrapper\n\nFixes #163 for DaterWr…
Browse files Browse the repository at this point in the history
…apper
  • Loading branch information
daidoji committed Dec 19, 2023
1 parent 20b6618 commit a5fbbf8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 30 deletions.
2 changes: 1 addition & 1 deletion wasm/demo/node/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Dater } from "cesride-wasm";

function main() {
const date = Dater.new_with_dts("2020-08-22T17:50:09.988921+00:00");
const date = new Dater("2020-08-22T17:50:09.988921+00:00", undefined, undefined, undefined, undefined, undefined);
console.log("<p>Date:</p>");
console.log("dts: " + date.dts + "<br/>");
console.log("dtsb: " + date.dtsb + "<br/>");
Expand Down
4 changes: 2 additions & 2 deletions wasm/demo/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
await init();

let dts = "2020-08-22T17:50:09.988921+00:00";
let dater = Dater.new_with_dts(dts);
let dater = new Dater(dts, undefined, undefined, undefined, undefined, undefined);
document.write("<p>Date:</p>");
document.write("<code>")
document.write("dts: " + dater.dts + "<br/>");
Expand All @@ -57,7 +57,7 @@
document.write("qb64b: " + dater.qb64b + "<br/>");
document.write("qb2: " + dater.qb2 + "<br/>");
try {
dater = Dater.new_with_dts(dts = "asdf");
dater = new Dater("asdf", undefined, undefined, undefined, undefined, undefined);
document.write("Wrong dater: " + dater.dts + "<br/>");
} catch (error) {
document.write("Error: " + error + "<br/>");
Expand Down
4 changes: 2 additions & 2 deletions wasm/demo/webpack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ document.write(`
`)

let dts = "2020-08-22T17:50:09.988921+00:00";
let dater = cesride.Dater.new_with_dts(dts);
let dater = new cesride.Dater(dts, undefined, undefined, undefined, undefined, undefined);

const icp = {
"v": "KERI10JSON00015a_",
Expand Down Expand Up @@ -51,7 +51,7 @@ document.write("qb64: " + dater.qb64() + "<br/>");
document.write("qb64b: " + dater.qb64b() + "<br/>");
document.write("qb2: " + dater.qb2() + "<br/>");
try {
dater = cesride.Dater.new_with_dts(dts = "asdf");
dater = new cesride.Dater("asdf", undefined, undefined, undefined, undefined, undefined);
document.write("Wrong dater: " + dater.dts() + "<br/>");
} catch (error) {
document.write("Error: " + error + "<br/>");
Expand Down
25 changes: 0 additions & 25 deletions wasm/src/primitives/dater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,6 @@ impl DaterWrapper {
Ok(DaterWrapper(dater))
}

pub fn new_with_dts(dts: &str, code: Option<String>) -> Result<DaterWrapper> {
let dater = Dater::new_with_dts(dts, code.as_deref()).as_js()?;
Ok(DaterWrapper(dater))
}

pub fn new_with_raw(raw: &[u8], code: Option<String>) -> Result<DaterWrapper> {
let dater = Dater::new_with_raw(raw, code.as_deref()).as_js()?;
Ok(DaterWrapper(dater))
}

pub fn new_with_qb64b(qb64b: &[u8]) -> Result<DaterWrapper> {
let dater = Dater::new_with_qb64b(qb64b).as_js()?;
Ok(DaterWrapper(dater))
}

pub fn new_with_qb64(qb64: &str) -> Result<DaterWrapper> {
let dater = Dater::new_with_qb64(qb64).as_js()?;
Ok(DaterWrapper(dater))
}

pub fn new_with_qb2(qb2: &[u8]) -> Result<DaterWrapper> {
let dater = Dater::new_with_qb2(qb2).as_js()?;
Ok(DaterWrapper(dater))
}

#[wasm_bindgen(getter)]
pub fn dts(&self) -> Result<String> {
self.0.dts().as_js().map_err(JsValue::from)
Expand Down

0 comments on commit a5fbbf8

Please sign in to comment.