-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
110 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,10 +46,14 @@ jobs: | |
deno-version: v1.x | ||
- run: deno lint | ||
- run: deno fmt --check --ignore=.vscode/ | ||
- run: deno publish --dry-run | ||
|
||
release: | ||
if: github.event_name == 'push' | ||
needs: [test, lint] | ||
permissions: | ||
contents: read | ||
id-token: write | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
@@ -58,6 +62,22 @@ jobs: | |
deno-version: v1.x | ||
- id: determine-version | ||
run: deno run -A scripts/determine-version.ts | ||
- if: github.ref_type == 'tag' | ||
run: | | ||
set -ex | ||
[[ "$(jq -r .version deno.json)" = "$VERSION" ]] | ||
env: | ||
VERSION: ${{ steps.determine-version.outputs.version }} | ||
- if: github.ref_type == 'branch' | ||
run: | | ||
set -ex | ||
jq \ | ||
--arg version "$VERSION" \ | ||
'.version = $version' \ | ||
deno.json > deno.json.tmp | ||
mv deno.json.tmp deno.json | ||
env: | ||
VERSION: ${{ steps.determine-version.outputs.version }} | ||
- if: github.ref_type == 'tag' | ||
run: '[[ "$VERSION" = "$GITHUB_REF_NAME" ]]' | ||
env: | ||
|
@@ -70,39 +90,7 @@ jobs: | |
popd | ||
env: | ||
VERSION: ${{ steps.determine-version.outputs.version }} | ||
- run: deno install -Af --unstable https://x.nest.land/[email protected]/eggs.ts | ||
- run: "eggs link '${{ secrets.NEST_API_KEY }}'" | ||
- if: github.ref_type == 'tag' | ||
uses: mikefarah/yq@master | ||
with: | ||
cmd: >- | ||
yq -i | ||
' strenv(GITHUB_REF_NAME) as $version | ||
| .version = $version | ||
| .unstable = false' | ||
egg.yaml | ||
- if: github.ref_type != 'tag' | ||
uses: mikefarah/yq@master | ||
with: | ||
cmd: >- | ||
yq -i | ||
' strenv(VERSION) as $version | ||
| .version = $version | ||
| .unstable = true' | ||
egg.yaml | ||
env: | ||
VERSION: ${{ steps.determine-version.outputs.version }} | ||
- run: | | ||
# Try up to 3 times as `eggs publish` frequently fails due to unknown | ||
# reason (I guess it's a bug on the server side): | ||
for _ in 1 2 3; do | ||
eggs publish --debug --yes --no-check || continue | ||
done | ||
- if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: eggs-debug.log | ||
path: ${{ github.workspace }}/eggs-debug.log | ||
- run: deno publish --allow-dirty | ||
- run: | | ||
set -e | ||
cd npm/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,39 +3,34 @@ | |
aitertools | ||
========== | ||
|
||
[![Latest version][Tag badge]][Deno module] | ||
[![Published on JSR][JSR badge]][JSR] | ||
[![Published on npm][npm badge]][npm] | ||
[![Published on nest.land][nest.land badge]][nest.land] | ||
[![LGPL 3.0][License badge]](./LICENSE) | ||
[![Deno Doc (API references)][Deno Doc badge]][Deno Doc] | ||
[![GitHub Actions][GitHub Actions status badge]][GitHub Actions] | ||
[![Codecov][Codecov badge]][Codecov] | ||
|
||
This library provides a [well-tested][Codecov] collection of small utility | ||
functions dealing with [async iterables]. You can think of it as .NET LINQ or | ||
Python aitertools for [Deno] & Node.js. | ||
|
||
[Tag badge]: https://img.shields.io/github/v/tag/dahlia/aitertools | ||
[Deno module]: https://deno.land/x/aitertools | ||
[JSR badge]: https://jsr.io/badges/@hongminhee/aitertools? | ||
[JSR]: https://jsr.io/@hongminhee/aitertools | ||
[npm badge]: https://img.shields.io/npm/v/aitertools | ||
[npm]: https://www.npmjs.com/package/aitertools | ||
[nest.land badge]: https://nest.land/badge.svg | ||
[nest.land]: https://nest.land/package/aitertools | ||
[License badge]: https://img.shields.io/github/license/dahlia/aitertools | ||
[Deno Doc]: https://doc.deno.land/https://deno.land/x/aitertools/mod.ts | ||
[Deno Doc badge]: https://img.shields.io/badge/api-deno%20doc-blue | ||
[GitHub Actions]: https://github.com/dahlia/aitertools/actions/workflows/build.yaml | ||
[GitHub Actions status badge]: https://github.com/dahlia/aitertools/actions/workflows/build.yaml/badge.svg | ||
[Codecov badge]: https://codecov.io/gh/dahlia/aitertools/branch/main/graph/badge.svg?token=UBDX4Inrz6 | ||
[Codecov]: https://codecov.io/gh/dahlia/aitertools | ||
[async iterables]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of | ||
[Deno]: https://deno.land/ | ||
[Deno]: https://deno.com/ | ||
|
||
|
||
Functions | ||
--------- | ||
|
||
For the complete list of functions, see the [complete API reference][Deno Doc]. | ||
For the complete list of functions, see the [complete API reference][JSR]. | ||
|
||
- `concat(...sources)`: Concatenate multiple async iterables into one. | ||
- `take(source, count)`: Take the first `count` items from the `source`. | ||
|
@@ -81,8 +76,12 @@ Usage | |
|
||
In Deno: | ||
|
||
~~~ console | ||
$ deno add @hongminhee/aitertools | ||
~~~ | ||
|
||
~~~ typescript | ||
import * as aitertools from "https://deno.land/x/aitertools/mod.ts"; | ||
import * as aitertools from "@hongminhee/aitertools"; | ||
~~~ | ||
|
||
In Node.js: | ||
|
@@ -100,11 +99,10 @@ Changelog | |
--------- | ||
|
||
See *[CHANGES.md](CHANGES.md)* file. Note that unreleased versions are also | ||
available on [nest.land] for Deno: | ||
available on [JSR] for Deno: | ||
|
||
~~~ typescript | ||
import * as aitertools | ||
from "https://x.nest.land/[email protected]+3f191d7/mod.ts"; | ||
deno add @hongminhee/aitertools@0.6.0-dev.36+9aa783c | ||
~~~ | ||
|
||
… and on [npm] with `dev` tag for Node.js: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "@hongminhee/aitertools", | ||
"version": "0.6.0", | ||
"exports": { | ||
".": "./mod.ts", | ||
"./collections": "./src/collections.ts", | ||
"./concat": "./src/concat.ts", | ||
"./drop": "./src/drop.ts", | ||
"./filter": "./src/filter.ts", | ||
"./fold": "./src/fold.ts", | ||
"./infinite": "./src/infinite.ts", | ||
"./map": "./src/map.ts", | ||
"./range": "./src/range.ts", | ||
"./take": "./src/take.ts", | ||
"./tee": "./src/tee.ts", | ||
"./testing": "./src/testing.ts", | ||
"./unique": "./src/unique.ts" | ||
}, | ||
"imports": { | ||
"@deno/dnt": "jsr:@deno/dnt@^0.41.0", | ||
"@std/assert": "jsr:@std/assert@^0.220.1", | ||
"fast-check": "npm:[email protected]" | ||
}, | ||
"lock": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
import { | ||
dirname, | ||
fromFileUrl, | ||
join, | ||
} from "https://deno.land/[email protected]/path/mod.ts"; | ||
import { dirname, fromFileUrl, join } from "jsr:@std/path@^0.220.1"; | ||
import * as commonmark from "npm:commonmark"; | ||
|
||
const projectDir = dirname(dirname(fromFileUrl(import.meta.url))); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { assertEquals } from "@std/assert"; | ||
|
||
/** | ||
* Makes an assertion that the elements of the `actual` iterable are equal to | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import * as fc from "npm:fast-check@3.14.0"; | ||
import { assertEquals } from "@std/assert"; | ||
import * as fc from "fast-check"; | ||
import { fromIterable, toArray, toMap, toSet } from "../src/collections.ts"; | ||
import { assertStreams } from "../src/testing.ts"; | ||
import { getAsyncIterable } from "./testing_test.ts"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
import { | ||
assert, | ||
assertRejects, | ||
} from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import * as fc from "npm:[email protected]"; | ||
import { assert, assertRejects } from "@std/assert"; | ||
import * as fc from "fast-check"; | ||
import { fromIterable, toArray } from "../src/collections.ts"; | ||
import { drop, dropEnd, dropWhile } from "../src/drop.ts"; | ||
import { count } from "../src/infinite.ts"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
import { | ||
assertEquals, | ||
assertRejects, | ||
} from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { assertEquals, assertRejects } from "@std/assert"; | ||
import { reduce } from "../src/fold.ts"; | ||
import { getAsyncIterable } from "./testing_test.ts"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertThrows } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { assertThrows } from "@std/assert"; | ||
import { count, cycle, repeat } from "../src/infinite.ts"; | ||
import { assertStreams, assertStreamStartsWith } from "../src/testing.ts"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertRejects } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { assertRejects } from "@std/assert"; | ||
import { count, repeat } from "../src/infinite.ts"; | ||
import { map } from "../src/map.ts"; | ||
import { assertStreams, assertStreamStartsWith } from "../src/testing.ts"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,10 @@ import { | |
assertMatch, | ||
assertNotEquals, | ||
assertThrows, | ||
} from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import * as fc from "npm:[email protected]"; | ||
import { assertStreams } from "../src/testing.ts"; | ||
} from "@std/assert"; | ||
import * as fc from "fast-check"; | ||
import { Range, range } from "../src/range.ts"; | ||
import { assertStreams } from "../src/testing.ts"; | ||
|
||
function validNumber(): fc.Arbitrary<number> { | ||
return fc.oneof( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
import { | ||
assert, | ||
assertRejects, | ||
} from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import * as fc from "npm:[email protected]"; | ||
import { assert, assertRejects } from "@std/assert"; | ||
import * as fc from "fast-check"; | ||
import { fromIterable, toArray } from "../src/collections.ts"; | ||
import { count } from "../src/infinite.ts"; | ||
import { range } from "../src/range.ts"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
import { | ||
AssertionError, | ||
assertRejects, | ||
} from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { AssertionError, assertRejects } from "@std/assert"; | ||
import * as fc from "npm:[email protected]"; | ||
import { fromIterable } from "../src/collections.ts"; | ||
import { assertStreams, assertStreamStartsWith } from "../src/testing.ts"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { assertEquals } from "@std/assert"; | ||
import { tee } from "../src/tee.ts"; | ||
import { assertStreams } from "../src/testing.ts"; | ||
import { groupBy, unique } from "../src/unique.ts"; | ||
|