Ejemplo n.º 1
0
zip(["a", "b", "c"], ["d", "e", "f"])[0].length;
zip(["a", "b", "c"], [1, 2, 3])[0].length;
zip(["a", "b", "c"], [1, 2, 3])[0][0] + "a";
zip(["a", "b", "c"], [1, 2, 3])[0][1] * 10;
// $ExpectError `x` property not found in Array
zip([{ x: 1 }], [{ x: 2, y: 1 }])[0].x;
// $ExpectError `y` property not found in object literal
zip([{ x: 1 }], [{ x: 2, y: 1 }])[0][0].y;
zip([{ x: 1 }], [{ x: 2, y: 1 }])[0][1].y;
// $ExpectError Flow could potentially catch this -- the tuple only has two elements.
zip([{ x: 1 }], [{ x: 2, y: 1 }])[0][2];

/**
 * _.zipWith
 */
zipWith(["a", "b", "c"], [1, 2, 3], (str, num) => ({ [str]: num }));
// $ExpectError `x` should be a `string`, `y` a `number`
zipWith(["a", "b", "c"], [1, 2, 3]).map(([x, y]) => x * y);

/**
 * _.isString
 */

var boolTrue: true;
var boolFalse: false;

boolTrue = isString("foo");
boolFalse = isString([""]);
boolFalse = isString({});
boolFalse = isString(5);
boolFalse = isString(function(f) {
(unzip(null): Array<*>);
(unzipWith(null, null): Array<*>);
(update(null, null, null): null);
(updateWith(null, null, null, null): null);
(values(null): Array<*>);
(valuesIn(null): Array<*>);
(without(): Array<*>);
(words(null, null): Array<*>);
(wrap(null, null): Function);
(xor(): Array<*>);
(xorBy(): Array<*>);
(xorWith(): Array<*>);
(zip(): Array<*>);
(zipObject(null, null): {});
(zipObjectDeep(null, null): {});
(zipWith(): Array<*>);
(entries(null): Array<*>);
(entriesIn(null): Array<*>);
(extend(): Object);
(extendWith(): Object);
(camelCase(null): '');
(capitalize(null): '');
(clamp(null, null, null): 0);
(clone(null): null);
(cloneDeep(null): null);
(cloneDeepWith(null, null): null);
(cloneWith(null, null): null);
(deburr(null): '');
(defaultTo(null, null): null);
(endsWith(null, null, null): false);
(eq(null, null): boolean);