polkadot-js / common

Utilities and base libraries for use across polkadot-js for Polkadot and Substrate. Includes base libraries, crypto helpers and cross-environment helpers.
Apache License 2.0
254 stars 147 forks source link

feat: `isRiscV` check function #1878

Closed peetzweg closed 1 year ago

peetzweg commented 1 year ago

Introduced in originally in this PR https://github.com/polkadot-js/api/pull/5699#pullrequestreview-1604611089 , it was suggested to be moved to the @polkadot/common package.

I've basically just copied over the code form the pr in the api package. The isWasm and isRiscV function signature differs as the isWasm's parameter of bytes is optional. Should we align both functions to have a optional or required parameter?

https://github.com/peetzweg/common/blob/d8a4d018f18fe69f2ad796d986ff950335cb2b35/packages/util/src/is/riscv.ts#L15-L17

https://github.com/peetzweg/common/blob/d8a4d018f18fe69f2ad796d986ff950335cb2b35/packages/util/src/is/wasm.ts#L15-L17

jacogr commented 1 year ago

I think it is fine as-is - unknown also caters for undefined. (So isWasm seems to go a bit overboard in this case - I think this is the case with a lot of functions, where ? is not strictly required...)

polkadot-js-bot commented 1 year ago

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.