Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.5.0 breaking on node 16.5-. #402

Open
lquixada opened this issue Dec 7, 2024 · 0 comments
Open

v1.5.0 breaking on node 16.5-. #402

lquixada opened this issue Dec 7, 2024 · 0 comments

Comments

@lquixada
Copy link

lquixada commented Dec 7, 2024

The 1.5.0 release is using the new-ish .at method of Javascript Array. However, that method was only available on Node 16.6+ which means that [email protected] broke backward compatibility with Node 16.5-.

I'm an author of a library called cross-fetch. It uses a rollup plugin called @rollup/plugin-terser which in turn uses smob@^1.0.0. Because of that caret version, all minor/patch versions of smub are automatically installed, including 1.5.0. cross-fetch supports Node 14+ but because of the at method usage, its CI cannot properly function.

Would you consider releasing a v1.6.0 with the same functionality but with a slightly different implementation? Here's a potential alternative to solve the problem:

function at(arr, index) {
  // Handle negative indices
  index = Math.trunc(index) || 0; // Ensure index is an integer
  if (index < 0) {
    index += arr.length;
  }
  // Return undefined if index is out of bounds
  if (index < 0 || index >= arr.length) {
    return undefined;
  }
  // Return the element at the index
  return arr[index];
};
@lquixada lquixada changed the title v1.5.0 breaking on node 14. v1.5.0 breaking on node 16.5-. Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant