Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parserOptions": {
"ecmaVersion": 5
},
"extends": "eslint:recommended",
"env": {
"commonjs": true,
"browser": true
},
"globals": {
"QueuingStrategy": "readonly"
},
"rules": {
"strict": [2, "global"],
"block-scoped-var": 2,
"consistent-return": 2,
"eqeqeq": [2, "smart"],
"guard-for-in": 2,
"no-caller": 2,
"no-extend-native": 2,
"no-loop-func": 2,
"no-new": 2,
"no-param-reassign": 2,
"no-return-assign": 2,
"no-unused-expressions": 2,
"no-use-before-define": 2,
"radix": [2, "always"],
"indent": [2, 2],
"quotes": [2, "double"],
"semi": [2, "always"]
}
}
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: purescript-contrib/setup-purescript@main

- uses: actions/setup-node@v1
with:
node-version: "10"

- name: Install dependencies
run: |
npm install -g bower
npm install
bower install --production

- name: Build source
run: npm run-script build

- name: Run tests
run: |
bower install
npm run-script test --if-present
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/.*
!/.gitignore
!/.eslintrc.json
!/.github/
package-lock.json
/bower_components/
/node_modules/
/.pulp-cache/
/output/
/generated-docs/
/.psc-package/
/.psc*
/.purs*
/.psa*
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
# purescript-web-streams

[![Latest release](http://img.shields.io/github/release/purescript-web/purescript-web-streams.svg)](https://github.com/purescript-web/purescript-web-streams/releases)
[![Build status](https://github.com/purescript/purescript-web-streams/workflows/CI/badge.svg?branch=master)](https://github.com/purescript/purescript-web-streams/actions?query=workflow%3ACI+branch%3Amaster)
[![Pursuit](https://pursuit.purescript.org/packages/purescript-web-streams/badge)](https://pursuit.purescript.org/packages/purescript-web-streams)

Type definitions and low level interface implementations for ReadableStream and related types from the [WHATWG Streams Living Standard](https://streams.spec.whatwg.org/).

## Installation

```
spago install web-streams
```

## Documentation

Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-web-streams).
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"private": true,
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "eslint src && pulp build -- --censor-lib --strict"
},
"devDependencies": {
"eslint": "^7.15.0",
"pulp": "^15.0.0",
"purescript-psa": "^0.8.0",
"rimraf": "^3.0.2"
}
}
4 changes: 3 additions & 1 deletion src/Web/Streams/QueuingStrategy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

exports.new = function(options) {
return function() {
return new QueuingStrategy(options);
Expand All @@ -14,4 +16,4 @@ exports.countQueuingStrategy = function(options) {
return function() {
return new CountQueuingStrategy(options);
};
};
};
4 changes: 3 additions & 1 deletion src/Web/Streams/ReadableStream.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

exports._new = function(source, strategy) {
return new ReadableStream(source, strategy);
};
Expand All @@ -23,4 +25,4 @@ exports.getReader = function(stream) {
exports._tee = function(tuple, stream) {
var r = stream.tee();
return tuple(r[0])(r[1]);
};
};
4 changes: 3 additions & 1 deletion src/Web/Streams/ReadableStreamController.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

exports.enqueue = function(chunk) {
return function(controller) {
return function() {
Expand All @@ -24,4 +26,4 @@ exports.desiredSize = function(controller) {
return function() {
return controller.desiredSize;
};
};
};
4 changes: 3 additions & 1 deletion src/Web/Streams/Reader.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"use strict";

exports._read = function(nothing, just, reader) {
return reader.read().then(function(res) {
if (res.done) {
return nothing;
}
return just(res.value);
});
};
};
4 changes: 3 additions & 1 deletion src/Web/Streams/Source.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

exports._make = function(options) {
var newOptions = {
start: function(controller) {
Expand All @@ -15,4 +17,4 @@ exports._make = function(options) {
};
}
return newOptions;
};
};