Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #269 from ethereumjs/fix-helper-memcopy
Browse files Browse the repository at this point in the history
Fix large string copies
  • Loading branch information
jochem-brouwer authored Jul 31, 2020
2 parents c6e8f3e + fbaf1b8 commit ba3e344
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- uses: actions/checkout@v1
- uses: actions/checkout@v2
- run: npm install
- run: npm run test

Expand Down
8 changes: 4 additions & 4 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import * as ethjsUtil from 'ethjs-util'
* @param {string} input string to check hex prefix of
*/
export const assertIsHexString = function(input: string): void {
const msg = `This method only supports 0x-prefixed hex strings but input was: ${input}`
if (!ethjsUtil.isHexString(input)) {
const msg = `This method only supports 0x-prefixed hex strings but input was: ${input}`
throw new Error(msg)
}
}
Expand All @@ -16,8 +16,8 @@ export const assertIsHexString = function(input: string): void {
* @param {Buffer} input value to check
*/
export const assertIsBuffer = function(input: Buffer): void {
const msg = `This method only supports Buffer but input was: ${input}`
if (!Buffer.isBuffer(input)) {
const msg = `This method only supports Buffer but input was: ${input}`
throw new Error(msg)
}
}
Expand All @@ -27,8 +27,8 @@ export const assertIsBuffer = function(input: Buffer): void {
* @param {number[]} input value to check
*/
export const assertIsArray = function(input: number[]): void {
const msg = `This method only supports number arrays but input was: ${input}`
if (!Array.isArray(input)) {
const msg = `This method only supports number arrays but input was: ${input}`
throw new Error(msg)
}
}
Expand All @@ -38,8 +38,8 @@ export const assertIsArray = function(input: number[]): void {
* @param {string} input value to check
*/
export const assertIsString = function(input: string): void {
const msg = `This method only supports strings but input was: ${input}`
if (typeof input !== 'string') {
const msg = `This method only supports strings but input was: ${input}`
throw new Error(msg)
}
}

0 comments on commit ba3e344

Please sign in to comment.