Skip to content

Commit 38ae011

Browse files
committed
🍃 v0.0.9
1 parent 60fa6da commit 38ae011

File tree

12 files changed

+33
-8
lines changed

12 files changed

+33
-8
lines changed

__tests__/animate.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const animate = require('../a');
1+
import animate from '../animate';
22

33
test('Can animate object properties', (done) => {
44
const counter = { value: 0 };

__tests__/bindAll.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const bindAll = require('../bindAll');
1+
import bindAll from '../bindAll';
22

33
const MAX = 25;
44

__tests__/clamp.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const clamp = require('../clamp');
1+
import clamp from '../clamp';
22

33
test('should clamp -10 between -5 and 5', () => {
44
expect(clamp(-10, -5, 5)).toBe(-5);

__tests__/forEachIn.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import forEachIn from '../forEachIn';
2+
3+
test('can loop through array', () => {
4+
let acc = 0;
5+
const arr = [1,1,1];
6+
7+
forEachIn(arr)(num => acc += num);
8+
expect(acc).toBe(3);
9+
});

__tests__/lerp.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const lerp = require('../lerp');
1+
import lerp from '../lerp';
22

33
test('linear interpolation from 0 to 10 with fraction 1 equals 10', () => {
44
expect(lerp(0, 10, 1)).toBe(10);

__tests__/raf.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Raf = require('../Raf');
1+
import Raf from '../Raf';
22

33
test('Raf can run', (done) => {
44
const raf = new Raf(() => done());

__tests__/round.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const round = require('../round');
1+
import round from '../round';
22

33
test('should return expected round value', () => {
44
expect(round(4.383, 1)).toBe(4.4);

dist/forEachIn.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
var forEachIn=function(){"use strict";return function(n){var r=n.length;return function(t){for(var u=0;u<r;u++)t(n[u])}}}();

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

forEachIn.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Array.prototype.forEach custom implementation.
3+
* @param {Array} arr
4+
* @returns {Function}
5+
*/
6+
function forEachIn(arr) {
7+
var arrLength = arr.length;
8+
return function(fn) {
9+
for (var i = 0; i < arrLength; i++) fn(arr[i]);
10+
}
11+
}
12+
13+
export default forEachIn;

0 commit comments

Comments
 (0)