+19
-7
@@ -1,2 +0,2 @@ | ||
| export function isArray(data) { | ||
| function isArray(data) { | ||
| try { | ||
@@ -9,3 +9,3 @@ return data.constructor.name.endsWith("Array"); | ||
| export function hasNext(data) { | ||
| function hasNext(data) { | ||
| try { | ||
@@ -18,3 +18,3 @@ return typeof data.next === "function"; | ||
| export function hasIterator(data) { | ||
| function hasIterator(data) { | ||
| try { | ||
@@ -27,3 +27,3 @@ return "@@iterator" in data; | ||
| export function hasSymbolIterator(data) { | ||
| function hasSymbolIterator(data) { | ||
| try { | ||
@@ -36,3 +36,3 @@ return Symbol.iterator in data.constructor.prototype; | ||
| export function getIterator(data) { | ||
| function getIterator(data) { | ||
| const iter = data["@@iterator"]; | ||
@@ -46,3 +46,3 @@ if (hasNext(iter)) { | ||
| export function createIterator(data) { | ||
| function createIterator(data) { | ||
| let i = 0; | ||
@@ -55,3 +55,3 @@ let len = data.length; | ||
| export function getOrCreateIterator(data) { | ||
| function getOrCreateIterator(data) { | ||
| if (hasNext(data)) { | ||
@@ -69,1 +69,13 @@ return data; | ||
| } | ||
| if (typeof module === "object") { | ||
| module.exports = { | ||
| isArray, | ||
| hasNext, | ||
| hasSymbolIterator, | ||
| hasIterator, | ||
| getIterator, | ||
| createIterator, | ||
| getOrCreateIterator | ||
| }; | ||
| } |
+1
-2
| { | ||
| "name": "iter-fun", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Fun with Iterables", | ||
| "main": "index.js", | ||
| "type": "module", | ||
| "files": [ | ||
@@ -8,0 +7,0 @@ "index.js" |
10075
1.22%67
19.64%No
NaN