Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 121 additions & 72 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion array/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ Returns the second element or undefined when there are less than two elements in

<!-- prettier-ignore-start -->
```typescript
([, x]: [any, any]) => any
([, x]: any[]) => any
```
<!-- prettier-ignore-end -->

Expand Down
4 changes: 4 additions & 0 deletions array/differs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import isNonNullable from "../is/nonNullable.js";

export default (xs, ys) =>
Boolean(!xs && ys) ||
Boolean(!ys && xs) ||
!isNonNullable(ys) ||
!isNonNullable(xs) ||
xs.length !== ys.length ||
xs.some((x, index) => x !== ys[index]);
2 changes: 2 additions & 0 deletions array/differs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ describe("differs", () => {
it("short-circuits over parameter presence", () => {
expect(differs(null, [1, 2])).toBe(true);
expect(differs([2, 3], undefined)).toBe(true);
expect(differs(null, null)).toBe(true);
expect(differs(undefined, undefined)).toBe(true);
});

it("compares elements index-wise", () => {
Expand Down
4 changes: 4 additions & 0 deletions array/differs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import isNonNullable from "../is/nonNullable";

export default (xs?: any[], ys?: any[]) =>
Boolean(!xs && ys) ||
Boolean(!ys && xs) ||
!isNonNullable(ys) ||
!isNonNullable(xs) ||
xs.length !== ys.length ||
xs.some((x, index) => x !== ys[index]);
2 changes: 1 addition & 1 deletion array/first.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default ([x]) => x;
export default ([x]: [any]) => x;
2 changes: 1 addition & 1 deletion array/second.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "second",
"description": "Returns the second element or undefined when there are less than two elements in the given array.",
"signature": "([, x]: [any, any]) => any",
"signature": "([, x]: any[]) => any",
"examples": [
{
"language": "javascript",
Expand Down
2 changes: 1 addition & 1 deletion array/second.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Returns the second element or undefined when there are less than two elements in

<!-- prettier-ignore-start -->
```typescript
([, x]: [any, any]) => any
([, x]: any[]) => any
```
<!-- prettier-ignore-end -->
2 changes: 1 addition & 1 deletion array/second.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default ([, x]) => x;
export default ([, x]: any[]): any => x;
2 changes: 1 addition & 1 deletion async/debounce.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env browser */

export default (f: { (...args: any[]): any }, wait: number) => {
let timeout;
let timeout: any;

return (...args: any[]) => {
const resolve = () => {
Expand Down
34 changes: 29 additions & 5 deletions compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,51 @@ const main = async cwd => {
"--skipLibCheck",
"--module ES6",
"--target ES2020",
"--noImplicitAny",
"--strict",
"-d",
quotePath(path.posix.normalize(filePath))
];

const command = [executable, ...args].join(" ");

console.time(command);

const windows = process.platform === "win32";

const { stdout, stderr } = await execAsync(command, {
const execOptions = {
windowsVerbatimArguments: windows
});
};

console.time(command);

const { stdout, stderr } = await execAsync(command, execOptions);

console.timeEnd(command);

console.log(`Compiled ${relativeFilePath}`);
console.log(`Compiled with strict mode ${relativeFilePath}`);

if (stdout || stderr) {
console.log({ stdout, stderr });
}

const nonStrictCommand = [
executable,
...args.filter(x => x !== "--strict")
].join(" ");

console.time(nonStrictCommand);

const { stdout: secondStdout, stderr: secondStderr } = await execAsync(
nonStrictCommand,
execOptions
);

console.timeEnd(nonStrictCommand);

console.log(`Compiled without strict mode ${relativeFilePath}`);

if (secondStdout || secondStderr) {
console.log({ secondStdout, secondStderr });
}
} catch (error) {
console.error(error);

Expand Down
Loading