Skip to content

Commit

Permalink
New version 4.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaifm committed May 19, 2024
1 parent e469081 commit 6886f61
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions linq.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ Enumerable.from = function (obj) {
});
}

// iterator object
if (typeof Symbol !== 'undefined' && typeof obj.next !== 'undefined') {
// object conforming to the iterator protocol
if (typeof obj.next == Types.Function) {
return new Enumerable(function () {
return new IEnumerator(
Functions.Blank,
Expand Down Expand Up @@ -3081,4 +3081,4 @@ var Grouping = function (groupKey, elements) {
};
Grouping.prototype = new ArrayEnumerable();

export default Enumerable;
export default Enumerable;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Mihai Ciuraru <[email protected]>",
"description": "linq.js - LINQ for JavaScript",
"type": "module",
"version": "4.0.2",
"version": "4.0.3",
"license": "MIT",
"homepage": "https://github.com/mihaifm/linq",
"repository": {
Expand All @@ -24,4 +24,4 @@
"main": "./linq.js",
"exports": "./linq.js",
"types": "./linq.d.ts"
}
}
5 changes: 4 additions & 1 deletion test/iterator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, testModule, deepEqual } from './testutils.js'
import { test, testModule, deepEqual, equal } from './testutils.js'
import Enumerable from '../linq.js'

testModule("Iterator");
Expand Down Expand Up @@ -54,6 +54,9 @@ test("from Iterable object", function () {
actual.push(a[0]);
}
deepEqual(actual, [1, 2]);

const set = new Set([1, 2, 3])
equal(Enumerable.from(set).first(), 1)
});

test("from Iterator object", function () {
Expand Down

0 comments on commit 6886f61

Please sign in to comment.