The focus of this package is to provide convenient functions and monads to write readable code
(as close as possible to elementary English language).
So there are no plans to support low-level interfaces for the v1.0
(like DataView or ArrayBuffer).
The primary features are the Maybe and Result monads,
and as monads and functors require a unary function parameter,
this package tries to close the gap between existing ECMAScript functions.
The general approach is the following:
-
Static unary functions and methods from JavaScript should be used as is, unless they return some odd values for edge cases (e.g.
NaN,Infinity,-1). In such cases, a corresponding function is added, to returnnull(orundefined). -
Unary instance methods should have a corresponding function that can be used as a callback. For example, for the
String.prototype.split()method, there is a correspondingsplit()function. So the code like.then(v ⇒ v.split(';'))can be just.then(split(';')).At the moment, most of the functions have the same name as the method, but that may change later before v1.0.
-
Unary function or method with an optional argument may have a corresponding function (or two) with strict parameters.
For example,
new Date()has a correspondingnow()function. -
Built-in binary and ternary functions and methods may have one or more corresponding functions to create callbacks with partial application of the arguments.
-
Must target ECMAScript 6.
-
Only versions starting from ECMAScript 2015 (
ES6) are considered. -
The version
ES6means that the feature is available inES6, even if it was introduced earlier. -
All versions after
ES6are written in their year-based format (e.g.ES2016).
-
-
May support newer versions of ECMAScript if they have wide browser and TypeScript support.
-
Legacy browsers support may be provided using
@babel.
Version 2.0 will be considered after v1.0 is released, if:
-
TypeScript adds support for nominal types, partial application, or other features that can improve compile-time strictness of the types.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Properties |
||
TBD |
||
The @perfective/common/array package covers the ES6 Array objects.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Prohibited. Use |
||
Prohibited. Use |
||
Prohibited. Use |
||
Properties |
||
TBD |
||
TBD |
||
|
||
Methods |
||
TBD |
||
TBD |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
Use |
||
|
||
TBD |
||
|
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
|
||
|
||
Use |
||
Use |
||
|
||
|
||
Use |
||
Use |
||
|
||
Use |
||
TBD |
||
Use |
||
Use |
||
TBD |
||
TBD |
||
|
||
Use |
||
TBD |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
Properties |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
Methods |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Methods |
||
TBD |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Methods |
||
TBD |
||
Not planned for the v1.0 as it is not part of the ES6 standard.
| JavaScript | ECMA | Perfective |
|---|---|---|
Methods |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
|
|
N/A |
N/A |
||
Not planned for the v1.0 as it is not part of the ES6 standard.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
Methods |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
The @perfective/common/boolean package covers the ES6 Boolean objects.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Prohibited.
Use ESLint the In conditional statements, |
||
Supported. Use the |
||
Methods |
||
Use the |
||
Not Supported. As the When a primitive value is expected, JavaScript invokes |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
Properties |
||
N/A |
||
N/A |
||
N/A |
||
Methods |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
The @perfective/common/date package covers the ES6 Date objects.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Discouraged. Instead, use the |
||
Supported. Use the |
||
Supported. Use the |
||
Supported. Use the |
||
TBD |
||
Discouraged. Use the |
||
Methods |
||
Discouraged. Use explicit conversions instead. |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
Disallowed. The method is deprecated. |
||
|
||
Discouraged. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method mutates the date. |
||
Prohibited. The method is deprecated and mutates the date. |
||
TBD |
||
TBD |
||
No custom support. Use |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD (Alias: |
||
TBD |
||
Discouraged. Use the
|
||
| JavaScript | ECMA | Perfective |
|---|---|---|
TBD |
| JavaScript | ECMA | Perfective |
|---|---|---|
TBD |
| JavaScript | ECMA | Perfective |
|---|---|---|
TBD |
| JavaScript | ECMA | Perfective |
|---|---|---|
TBD |
The @perfective/common/error package provides support for the Error Objects.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Use |
||
Properties |
||
TBD |
||
|
Not supported as non-standard. Use |
|
|
Not supported as non-standard. Use |
|
|
Not supported as non-standard. Use |
|
TBD |
||
TBD |
||
|
|
|
Methods |
||
|
||
The @perfective/common/error package provides support for the Error Objects.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Use |
||
Not planned for the v1.0 as it is not part of the ES6 standard.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
Methods |
||
N/A |
||
N/A |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
The @perfective/common/function package covers the ES6 Function objects.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Prohibited as unsafe. |
||
Prohibited as unsafe. |
||
Properties |
||
Prohibited as deprecated and non-standard. |
||
Prohibited as deprecated and non-standard. |
||
Prohibited as non-standard. |
||
|
||
Methods |
||
Supported via the |
||
TBD. |
||
TBD. |
||
TBD. |
||
Use the |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
TBD |
| JavaScript | ECMA | Perfective |
|---|---|---|
Prohibited. Prefer |
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
|
Not supported as non-standard. |
|
| JavaScript | ECMA | Perfective |
|---|---|---|
Methods |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Prohibited. Use |
| JavaScript | ECMA | Perfective |
|---|---|---|
Prohibited. Use |
| JavaScript | ECMA | Perfective |
|---|---|---|
Methods |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Methods |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Properties |
||
TBD |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
The @perfective/common/number package covers the ES6 Math object.
| JavaScript | ECMA | Perfective |
|---|---|---|
Properties |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
Methods |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
N/A as a low-level (binary data) function. |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
N/A as a low-level (binary data) function. |
||
Use |
||
Use |
||
Use |
||
Use |
||
Prefer |
||
Prefer |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Discouraged.
Return |
The @perfective/common/number package covers the ES6 Number objects.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Prohibited. Use the |
||
Discouraged. Use explicit conversions (e.g. |
||
Properties |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
Discouraged
|
||
Use directly |
||
Use directly |
||
Methods |
||
Prefer |
||
Prefer |
||
Prefer |
||
Prefer |
||
Prefer |
||
Prefer |
||
Use |
||
Use |
||
TBD |
||
Use |
||
Prefer |
||
TBD |
||
The @perfective/common/object package covers the ECMAScript Object objects.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Disallowed. Use the ESLint |
||
Properties |
||
Deprecated |
||
Methods |
||
Deprecated |
||
Deprecated |
||
Deprecated |
||
Deprecated |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
|
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
TBD |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
Use directly |
||
Prohibited |
||
TBD |
||
Use |
||
TBD |
||
Use directly |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Prohibited. Use |
| JavaScript | ECMA | Perfective |
|---|---|---|
Prohibited. Use Use |
The @perfective/common/promise package provides support for the Promise Jobs.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
|
||
Properties |
||
No custom support. |
||
Methods |
||
No custom support. |
||
No custom support. |
||
No custom support. |
||
Use |
||
No custom support. |
||
No custom support. |
||
Use |
||
Use |
||
Use |
||
ES6 Proxy object internal methods and internal slots.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
|
|
TBD |
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
The @perfective/common/error package provides support for the Error Objects.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Use |
||
The @perfective/common/error package provides support for the Error Objects.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Use |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Methods |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
|
|
TBD |
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Properties |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
Prohibited as deprecated. |
||
TBD |
||
Prohibited as deprecated. |
||
Prohibited as deprecated. |
||
Prohibited as deprecated. |
||
TBD |
||
Prohibited as deprecated. |
||
Prohibited as deprecated. |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
Deprecated |
||
TBD |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Properties |
||
TBD |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
Properties |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
Methods |
||
N/A |
||
N/A |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Prohibited. Use the ESLint |
||
Use to cast a value to |
||
Properties |
||
Use the |
||
Methods |
||
No custom support |
||
Deprecated |
||
TBD |
||
Deprecated |
||
Deprecated |
||
Deprecated |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Deprecated |
||
Deprecated |
||
Deprecated |
||
Use |
||
Use |
||
Use |
||
Use |
||
TBD |
||
Deprecated |
||
Use |
||
Deprecated |
||
TBD |
||
TBD |
||
TBD |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Use |
||
Deprecated |
||
Use |
||
Use |
||
Deprecated |
||
Deprecated |
||
Deprecated |
||
Prefer |
||
Deprecated |
||
TBD |
||
TBD |
||
Use |
||
Use |
||
Use |
||
TBD |
||
Use |
||
TBD |
||
TBD |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Properties |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
The @perfective/common/error package provides support for the Error Objects.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Use |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Properties |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
Methods |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
N/A |
||
The @perfective/common/error package provides support for the Error Objects.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
Use |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
Not planned for the v1.0 as it is a low-level (binary data) functionality.
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
N/A |
||
@perfective/common provides functions to work with undefined.
| JavaScript | ECMA | Perfective |
|---|---|---|
|
| JavaScript | ECMA | Perfective |
|---|---|---|
Prohibited as deprecated. |
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
| JavaScript | ECMA | Perfective |
|---|---|---|
Constructor |
||
TBD |
||
Methods |
||
TBD |
||
TBD |
||
TBD |
||
TBD |
||
Addition ( |
||
Addition assignment ( |
Discouraged as it mutates the value (TODO #33) |
|
Assignment ( |
Use directly |
|
Use directly |
||
Use directly |
||
Discouraged. Prefer |
||
Bitwise AND ( |
Discouraged as a bitwise operator. Use Bitmasks
from |
|
Discouraged as a bitwise operator and as it mutates the value. |
||
Bitwise NOT ( |
Discouraged as a bitwise operator. Use Bitmasks
from |
|
Bitwise OR ( |
Discouraged as a bitwise operator. Use Bitmasks
from |
|
Discouraged as a bitwise operator and as it mutates the value. |
||
Bitwise XOR ( |
Discouraged as a bitwise operator. Use Bitmasks
from |
|
Discouraged as a bitwise operator and as it mutates the value. |
||
Use directly |
||
Comma operator ( |
Use directly |
|
if (isX) {
return a;
}
return b;
{
a: isX ? a : b,
}
|
||
Decrement ( |
Discouraged as it mutates the value (TODO #33) |
|
Discouraged as it mutates the value. |
||
Use directly |
||
Use directly |
||
Division ( |
||
Division assignment ( |
Discouraged as it mutates the value (TODO #33). |
|
Equality ( |
Disallowed. Use the ESLint The loose equality has obscure behavior:
Always use strict equality.
When you need to coerce multiple types with logic that does not match |
|
Exponentiation ( |
||
Discouraged as it mutates the value (TODO #33) |
||
Use directly |
||
Use directly |
||
Greater than ( |
Use |
|
Use |
||
Grouping operator ( |
Use directly |
|
Use directly |
||
Use directly |
||
TBD |
||
Increment ( |
||
Inequality ( |
Disallowed. Prefer strict inequality Use the ESLint |
|
|
||
Left shift ( |
Discouraged as a bitwise operator. |
|
Discouraged as a bitwise operator and as it mutates the value. |
||
Less than ( |
Use |
|
Use |
||
Logical AND ( |
Allowed.
Use |
|
Logical AND assignment ( |
Discouraged as it mutates the value. |
|
Logical NOT ( |
Allowed.
Use |
|
Double NOT ( |
Disallowed. Use the |
|
Logical OR ( |
Allowed.
Use |
|
Logical OR assignment ( |
Discouraged as it mutates the value. |
|
Multiplication ( |
||
Discouraged as it mutates the value (see TODO #33). |
||
Use directly. |
||
Use directly. |
||
Use directly. |
||
Discouraged as it mutates the value. |
||
Discouraged. Prefer maybe(x).or(y) |
||
Use directly. |
||
|
Use directly. |
|
Optional chaining ( |
Discouraged. Prefer maybe(x).pick('y') |
|
Use directly. Use |
||
Remainder ( |
||
Remainder assignment ( |
Discouraged as it mutates the value (TODO #33) |
|
Right shift ( |
Discouraged as a bitwise operator. |
|
Right shift assignment ( |
Discouraged as a bitwise operator and as it mutates the value. |
|
|
Use directly |
|
Strict equality ( |
Allowed. Use |
|
Strict inequality ( |
Allowed. Use |
|
Subtraction ( |
||
Discouraged as it mutates the value (TODO #33) |
||
Use directly |
||
Use directly |
||
Allowed. Use |
||
Unary negation ( |
Allowed. Use |
|
Unary plus ( |
Disallowed. Use |
|
Unsigned right shift ( |
Discouraged as a bitwise operator. |
|
Discouraged as a bitwise operator and as it mutates the value. |
||
Discouraged. Use |
||
Use directly |
||
Use directly |
-
ECMA Script Specification
-
ECMAScript Internationalization API Specification