UNPKG

prray

Version:

'Promisified' Array, comes with async method supports(such as mapAsync). And it is compatible with normal array.

30 lines (29 loc) 1.61 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const ava_1 = require("ava"); const prray_1 = require("../src/prray"); ava_1.default('prray isPrray', (t) => __awaiter(this, void 0, void 0, function* () { t.true(prray_1.Prray.isPrray(new prray_1.Prray(1, 2, 3))); t.true(prray_1.Prray.isPrray(prray_1.Prray.of(1, 2, 3))); t.true(prray_1.Prray.isPrray(prray_1.Prray.from([1, 2, 3]))); t.true(prray_1.Prray.isPrray(prray_1.prray([1, 2, 3]))); t.false(prray_1.Prray.isPrray([1, 2, 3])); t.false(prray_1.Prray.isPrray(new Array(1, 2, 3))); t.false(prray_1.Prray.isPrray({ foo: [1, 2, 3] })); t.false(prray_1.Prray.isPrray('1,2,3')); t.false(prray_1.Prray.isPrray(undefined)); t.false(prray_1.Prray.isPrray(null)); t.false(prray_1.Prray.isPrray(1)); t.false(prray_1.Prray.isPrray({})); t.false(prray_1.Prray.isPrray(Object)); t.false(prray_1.Prray.isPrray(prray_1.Prray)); t.false(prray_1.Prray.isPrray(console.log)); }));