Skip to content

Possible polyfill bug #50

@guybedford

Description

@guybedford

I just noticed this line in the polyfill - https://github.com/WebAssembly/js-string-builtins/blob/main/test/js-api/js-string/polyfill.js#L150

    if (startIndex > string.length,
        endIndex > string.length,
        endIndex < startIndex) {
      return "";

Seems like this should probably be:

    if (startIndex > string.length ||
        endIndex > string.length ||
        endIndex < startIndex) {
      return "";

Since , expressions in JS only return their last value, making the first case only if (endIndex < startIndex) {.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions