Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homogenize example and remove reference to borsh-js #87

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion examples/cjs/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const borsh = require('borsh-js');
const borsh = require('borsh');

const encodedU16 = borsh.serialize('u16', 2);
const decodedU16 = borsh.deserialize('u16', encodedU16);
Expand All @@ -7,3 +7,7 @@ console.log(decodedU16);
const encodedStr = borsh.serialize('string', 'testing');
const decodedStr = borsh.deserialize('string', encodedStr);
console.log(decodedStr);

const encodedU64 = borsh.serialize('u64', '100000000000000000');
const decodedU64 = borsh.deserialize('u64', encodedU64);
console.log(decodedU64);
5 changes: 4 additions & 1 deletion examples/cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"version": "2.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"borsh-js": "file:../../"
"borsh": "^2"
}
}
12 changes: 8 additions & 4 deletions examples/esm/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import * as borsh from 'borsh-js';
import * as borsh from 'borsh';

const encodedU16 = borsh.serialize('u16', 2);
const decodedU16 = borsh.deserialize('u16', encodedU16);
console.log(decodedU16);

const encodedStr = borsh.serialize('u64', '100000000000000000');
const decodedStr = borsh.deserialize('u64', encodedStr);
console.log(decodedStr);
const encodedStr = borsh.serialize('string', 'testing');
const decodedStr = borsh.deserialize('string', encodedStr);
console.log(decodedStr);

const encodedU64 = borsh.serialize('u64', '100000000000000000');
const decodedU64 = borsh.deserialize('u64', encodedU64);
console.log(decodedU64);
5 changes: 4 additions & 1 deletion examples/esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"description": "",
"type": "module",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"borsh-js": "file:../../"
"borsh": "^2"
}
}
Loading