|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
540 bytes
|
| Line | |
|---|
| 1 | import value from "./value.js";
|
|---|
| 2 | import numberArray, {isNumberArray} from "./numberArray.js";
|
|---|
| 3 |
|
|---|
| 4 | export default function(a, b) {
|
|---|
| 5 | return (isNumberArray(b) ? numberArray : genericArray)(a, b);
|
|---|
| 6 | }
|
|---|
| 7 |
|
|---|
| 8 | export function genericArray(a, b) {
|
|---|
| 9 | var nb = b ? b.length : 0,
|
|---|
| 10 | na = a ? Math.min(nb, a.length) : 0,
|
|---|
| 11 | x = new Array(na),
|
|---|
| 12 | c = new Array(nb),
|
|---|
| 13 | i;
|
|---|
| 14 |
|
|---|
| 15 | for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);
|
|---|
| 16 | for (; i < nb; ++i) c[i] = b[i];
|
|---|
| 17 |
|
|---|
| 18 | return function(t) {
|
|---|
| 19 | for (i = 0; i < na; ++i) c[i] = x[i](t);
|
|---|
| 20 | return c;
|
|---|
| 21 | };
|
|---|
| 22 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.