-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[RFC]: rename primitive array assert packages #14283
Copy link
Copy link
Open
Labels
MaintainersIssue which should be handled by project maintainers & is not recommended for external contributors.Issue which should be handled by project maintainers & is not recommended for external contributors.Needs DiscussionNeeds further discussion.Needs further discussion.RFCRequest for comments. Feature requests and proposed changes.Request for comments. Feature requests and proposed changes.release: MajorBreaking change requiring a new major release.Breaking change requiring a new major release.
Description
Activity
Metadata
Metadata
Assignees
Labels
MaintainersIssue which should be handled by project maintainers & is not recommended for external contributors.Issue which should be handled by project maintainers & is not recommended for external contributors.Needs DiscussionNeeds further discussion.Needs further discussion.RFCRequest for comments. Feature requests and proposed changes.Request for comments. Feature requests and proposed changes.release: MajorBreaking change requiring a new major release.Breaking change requiring a new major release.
Description
This RFC proposes renaming the following packages:
is-array-array=>is-array-of-arraysisArrayArray=>isArrayOfArraysis-boolean-array=>is-array-of-booleansisBooleanArray=>isArrayOfBooleansis-date-object-array=>is-array-of-date-objectsisDataObjectArray=>isArrayOfDateObjectsis-function-array=>is-array-of-functionsisFunctionArray=>isArrayOfFunctionsis-integer-array=>is-array-of-integersisIntegerArray=>isArrayOfIntegersis-nan-array=>is-array-of-nansisNaNArray=>isArrayOfNaNsis-negative-integer-array=>is-array-of-negative-integersisNegativeIntegerArray=>isArrayOfNegativeIntegersis-negative-number-array=>is-array-of-negative-numbersisNegativeNumberArray=>isArrayOfNegativeNumbersis-nonnegative-integer-array=>is-array-of-nonnegative-integersisNonNegativeIntegerArray=>isArrayOfNonNegativeIntegersis-nonnegative-number-array=>is-array-of-nonnegative-numbersisNonNegativeNumberArray=>isArrayOfNonNegativeNumbersis-nonpositive-integer-array=>is-array-of-nonpositive-integersisNonPositiveIntegerArray=>isArrayOfNonPositiveIntegersis-nonpositive-number-array=>is-array-of-nonpositive-numbersisNonPositiveNumberArray=>isArrayOfNonPositiveNumbersis-null-array=>is-array-of-nullsisNullArray=>isArrayOfNullsis-object-array=>is-array-of-objectsisObjectArray=>isArrayOfObjectsis-plain-object-array=>is-array-of-plain-objectsisPlainObjectArray=>isArrayOfPlainObjectsis-positive-integer-array=>is-array-of-positive-integersisPositiveIntegerArray=>isArrayOfPositiveIntegersis-positive-number-array=>is-array-of-positive-numbersisPositiveNumberArray=>isArrayOfPositiveNumbersis-primitive-array=>is-array-of-primitivesisPrimitiveArray=>isArrayOfPrimitivesis-probability-array=>is-array-of-probabilitiesisProbabilityArray=>isArrayOfProbabilitiesis-safe-integer-array=>is-array-of-safe-integersisSafeIntegerArray=>isArrayOfSafeIntegersis-string-array=>is-array-of-stringsisStringArray=>isArrayOfStringsis-symbol-array=>is-array-of-symbolsisSymbolArray=>isArrayOfSymbolsRationale
As the project has grown and started accumulating custom array types (e.g.,
BooleanArray,Complex128Array,Int64Array, etc), older naming conventions are beginning to conflict with continued project evolution.The most immediate example is
is-booleanarrayandis-boolean-array. Which is the assertion package forBooleanArrayand which is for an array of booleans (e.g.,[ true, false, true ])? It is not obvious which is which and can be a point of confusion.This RFC proposes migrating existing packages which refer explicitly to the contents of a collection and not to a particular instance type to a new naming convention which more explicitly indicates what the package is intended to test for and should avoid conflicts with any future array types (e.g.,
StringArray,ObjectArray, etc).Notes
Packages which are not included in the proposed migration:
is-between-arrayis-falsy-arrayis-finite-arrayis-truthy-arrayis-unity-probability-arrayThese packages were considered to be (a) highly unlikely to conflict with future specialized array constructors and (b) not have good readability with the proposed naming convention (e.g.,
isArrayOfBetween).Related Issues
N/A
Questions
The proposed changes will create quite a bit of churn throughout the project as many of these packages are heavily used. The question is then whether the churn is worth it. In my opinion, it is, but others may have different opinions.
Is there a better naming convention than the
*-of-*proposal above?JSDoc conventions are intentionally left out (e.g.,
@param {NonNegativeIntegerArray}). IMO, these also need to be migrated in order to avoid confusion with class instances, but I think this is something which can be addressed in a separate RFC, as it is not clear what the naming convention should be (e.g.,Array<integer>,Array<nonnegative_integer>, something else?).Other
cc @Planeshifter as we previously discussed the confusion between
is-boolean-arrayandis-booleanarray. This is my attempt to resolve that confusion.Should this RFC be accepted and completed, we'll want to deprecate the existing packages and have them point to the new packages on both npm and GitHub.
Checklist
RFC:.