Skip to content

Commit

Permalink
feat(api): add asInt() coercion helper
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Nov 2, 2021
1 parent e57ad7e commit 49cd772
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/api/src/typedarray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ export const asGLType = (type: GLType | Type): GLType => {
return t !== undefined ? t : <GLType>type;
};

/**
* Coerces given numeric args to integer values.
*/
export const asInt = (...args: number[]) => args.map((x) => x | 0);

/**
* Returns byte size for given {@link Type} ID or {@link GLType} enum.
*
Expand Down

0 comments on commit 49cd772

Please sign in to comment.