Visitar URL original
[Implement] Naive Buffer.from, and friends by jtenner · Pull Request #6 · AssemblyScript/node · GitHub
Skip to content
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add ascii encoding
  • Loading branch information
jtenner committed Mar 13, 2020
commit 11be548adfc246189130692b93c8d0c79d8dc7dc
3 changes: 2 additions & 1 deletion assembly/buffer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export class Buffer extends Uint8Array {
buffer = String.UTF16.encode(value);
} else if (encoding == "hex") {
buffer = Buffer.HEX.encode(value);
// TODO: add ascii encoding
} else if (encoding == "ascii") {
buffer = Buffer.ASCII.encode(value);
} else {
throw new TypeError("Invalid string encoding.");
}
Expand Down