Skip to content

Matching Js argument order with Belt #2975

@rickyvetter

Description

@rickyvetter

Currently Belt and the Js modules have the opposite argument order: Js.Array.map(fn, array), Belt.Array.map(array, fn). I've noticed some pain in having to switch between the two and was wondering how people felt about moving Js.X functions to the argument order that matches Belt for consistency.

Procedure for converting any module X:

Minor version bump:

Introduce Js.X2 with the new order, deprecate all functions in Js.X, provide a codemod from X to X2.

Major version bump:

Replace Js.X with the contents of Js.X2 and remove Js.X2**. Provide a codemod from X2 to X (this one is very easy - just mechanical).

** alternatively we could do this a bit slower and deprecate X2 and in a future major version remove it.

How do people feel about this? Could execution be better?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions