(
value: string,
opts: StringToBytesOpts = {},
)
| 236 | * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) |
| 237 | */ |
| 238 | export function stringToBytes( |
| 239 | value: string, |
| 240 | opts: StringToBytesOpts = {}, |
| 241 | ): ByteArray { |
| 242 | const bytes = encoder.encode(value) |
| 243 | if (typeof opts.size === 'number') { |
| 244 | assertSize(bytes, { size: opts.size }) |
| 245 | return pad(bytes, { dir: 'right', size: opts.size }) |
| 246 | } |
| 247 | return bytes |
| 248 | } |
no test coverage detected