Skip to content

Commit

Permalink
rename tests and fix bad transforms
Browse files Browse the repository at this point in the history
  • Loading branch information
planttheidea committed Dec 16, 2023
1 parent 1805a49 commit 2791a85
Show file tree
Hide file tree
Showing 36 changed files with 132 additions and 65 deletions.
3 changes: 0 additions & 3 deletions __tests__/__fixtures__/cached/findIndexRight/code.js

This file was deleted.

1 change: 0 additions & 1 deletion __tests__/__fixtures__/cached/findIndexRight/output.js

This file was deleted.

3 changes: 3 additions & 0 deletions __tests__/__fixtures__/cached/findLast/code.js
@@ -0,0 +1,3 @@
import { findLast } from '../../../../src/inline-loops.macro';

const lastEven = findLast(array, fn);
10 changes: 10 additions & 0 deletions __tests__/__fixtures__/cached/findLast/output.js
@@ -0,0 +1,10 @@
let _match;
for (let _key = array.length, _value, _result; --_key >= 0; ) {
_value = array[_key];
_result = fn(_value, _key, array);
if (_result) {
_match = _value;
break;
}
}
const lastEven = _match;
3 changes: 3 additions & 0 deletions __tests__/__fixtures__/cached/findLastIndex/code.js
@@ -0,0 +1,3 @@
import { findLastIndex } from '../../../../src/inline-loops.macro';

const firstEven = findLastIndex(array, fn);
10 changes: 10 additions & 0 deletions __tests__/__fixtures__/cached/findLastIndex/output.js
@@ -0,0 +1,10 @@
let _match = -1;
for (let _key = array.length, _value, _result; --_key >= 0; ) {
_value = array[_key];
_result = fn(_value, _key, array);
if (_result) {
_match = _key;
break;
}
}
const firstEven = _match;
3 changes: 0 additions & 3 deletions __tests__/__fixtures__/cached/findRight/code.js

This file was deleted.

1 change: 0 additions & 1 deletion __tests__/__fixtures__/cached/findRight/output.js

This file was deleted.

This file was deleted.

This file was deleted.

@@ -0,0 +1,3 @@
import { findLast } from '../../../../src/inline-loops.macro';

const lastEven = findLast(array, (value) => value % 2 === 0);
10 changes: 10 additions & 0 deletions __tests__/__fixtures__/inlined-arrow-expression/findLast/output.js
@@ -0,0 +1,10 @@
let _match;
for (let _key = array.length, _value, _result; --_key >= 0; ) {
_value = array[_key];
_result = _value % 2 === 0;
if (_result) {
_match = _value;
break;
}
}
const lastEven = _match;

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 5 additions & 0 deletions __tests__/__fixtures__/inlined-arrow-return/findLast/code.js
@@ -0,0 +1,5 @@
import { findLast } from '../../../../src/inline-loops.macro';

const lastEven = findLast(array, (value) => {
return value % 2 === 0;
});
10 changes: 10 additions & 0 deletions __tests__/__fixtures__/inlined-arrow-return/findLast/output.js
@@ -0,0 +1,10 @@
let _match;
for (let _key = array.length, _value, _result; --_key >= 0; ) {
_value = array[_key];
_result = _value % 2 === 0;
if (_result) {
_match = _value;
break;
}
}
const lastEven = _match;
@@ -0,0 +1,5 @@
import { findLastIndex } from '../../../../src/inline-loops.macro';

const firstEven = findLastIndex(array, (value) => {
return value % 2 === 0;
});
@@ -0,0 +1,10 @@
let _match = -1;
for (let _key = array.length, _value, _result; --_key >= 0; ) {
_value = array[_key];
_result = _value % 2 === 0;
if (_result) {
_match = _key;
break;
}
}
const firstEven = _match;
5 changes: 0 additions & 5 deletions __tests__/__fixtures__/inlined-arrow-return/findRight/code.js

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -0,0 +1,5 @@
import { findLast } from '../../../../src/inline-loops.macro';

const lastEven = findLast(array, function (value) {
return value % 2 === 0;
});
10 changes: 10 additions & 0 deletions __tests__/__fixtures__/inlined-function-return/findLast/output.js
@@ -0,0 +1,10 @@
let _match;
for (let _key = array.length, _value, _result; --_key >= 0; ) {
_value = array[_key];
_result = _value % 2 === 0;
if (_result) {
_match = _value;
break;
}
}
const lastEven = _match;
@@ -0,0 +1,5 @@
import { findLastIndex } from '../../../../src/inline-loops.macro';

const firstEven = findLastIndex(array, function (value) {
return value % 2 === 0;
});
@@ -0,0 +1,10 @@
let _match = -1;
for (let _key = array.length, _value, _result; --_key >= 0; ) {
_value = array[_key];
_result = _value % 2 === 0;
if (_result) {
_match = _key;
break;
}
}
const firstEven = _match;

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions __tests__/__fixtures__/uncached/findIndexRight/code.js
@@ -1,6 +1,6 @@
import { findIndexRight } from "../../../../src/inline-loops.macro";
import { findLastIndex } from '../../../../src/inline-loops.macro';

const firstEven = findIndexRight([1, 2, 3, 4], value => {
const firstEven = findLastIndex([1, 2, 3, 4], (value) => {
const isValueEven = value % 2 === 0;

return isValueEven;
Expand Down
16 changes: 12 additions & 4 deletions __tests__/__fixtures__/uncached/findIndexRight/output.js
@@ -1,4 +1,12 @@
const firstEven = findIndexRight([1, 2, 3, 4], (value) => {
const isValueEven = value % 2 === 0;
return isValueEven;
});
const _collection = [1, 2, 3, 4];
let _match = -1;
for (let _key = _collection.length, _value, _result; --_key >= 0; ) {
_value = _collection[_key];
const _isValueEven = _value % 2 === 0;
_result = _isValueEven;
if (_result) {
_match = _key;
break;
}
}
const firstEven = _match;
7 changes: 7 additions & 0 deletions __tests__/__fixtures__/uncached/findLast/code.js
@@ -0,0 +1,7 @@
import { findLast } from '../../../../src/inline-loops.macro';

const lastEven = findLast([1, 2, 3, 4], (value) => {
const isValueEven = value % 2 === 0;

return isValueEven;
});
12 changes: 12 additions & 0 deletions __tests__/__fixtures__/uncached/findLast/output.js
@@ -0,0 +1,12 @@
const _collection = [1, 2, 3, 4];
let _match;
for (let _key = _collection.length, _value, _result; --_key >= 0; ) {
_value = _collection[_key];
const _isValueEven = _value % 2 === 0;
_result = _isValueEven;
if (_result) {
_match = _value;
break;
}
}
const lastEven = _match;
7 changes: 0 additions & 7 deletions __tests__/__fixtures__/uncached/findRight/code.js

This file was deleted.

4 changes: 0 additions & 4 deletions __tests__/__fixtures__/uncached/findRight/output.js

This file was deleted.

0 comments on commit 2791a85

Please sign in to comment.