Skip to content

Commit

Permalink
feat!: switched to ESM, updated deps, switched to GitHub CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bergos committed Jun 9, 2024
1 parent 371f927 commit b9a7ba8
Show file tree
Hide file tree
Showing 9 changed files with 180 additions and 132 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
- package-ecosystem: npm
directory: /
schedule:
interval: daily
versioning-strategy: increase-if-necessary
21 changes: 21 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test
on:
- pull_request
- push
jobs:
test:
runs-on: ubuntu-24.04
strategy:
matrix:
node:
- '18'
- '20'
- '22'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npm test
- uses: codecov/codecov-action@v4
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.idea
coverage
node_modules
package-lock.json
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Thomas Bergwinkl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# rdf-stream-filter

[![Build Status](https://travis-ci.org/rdf-ext/rdf-stream-filter.svg?branch=master)](https://travis-ci.org/rdf-ext/rdf-stream-filter)
[![npm version](https://badge.fury.io/js/rdf-stream-filter.svg)](https://badge.fury.io/js/rdf-stream-filter)
[![build status](https://img.shields.io/github/actions/workflow/status/rdf-ext/rdf-stream-filter/test.yaml?branch=master)](https://github.com/rdf-ext/rdf-stream-filter/actions/workflows/test.yaml)
[![npm version](https://img.shields.io/npm/v/rdf-stream-filter.svg)](https://www.npmjs.com/package/rdf-stream-filter)

Filters a [RDFJS Stream](https://github.com/rdfjs/representation-task-force/) using a filter callback or quad pattern.
Filters a [RDF/JS Stream](https://rdf.js.org/stream-spec/#stream-interface) using a filter callback or quad pattern.
14 changes: 6 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
'use strict'

const Readable = require('readable-stream')
import { Readable } from 'readable-stream'

function buildQuadFilter (subject, predicate, object, graph) {
return function (quad) {
Expand Down Expand Up @@ -32,13 +30,13 @@ class FilterStream extends Readable {

this._readableState.objectMode = true

let filter = typeof subject === 'function' ? subject : buildQuadFilter(subject, predicate, object, graph)
const filter = typeof subject === 'function' ? subject : buildQuadFilter(subject, predicate, object, graph)

input.once('close', () => {
this.emit('close')
})

input.on('data', (quad) => {
input.on('data', quad => {
if (filter(quad)) {
this.push(quad)
}
Expand All @@ -48,11 +46,11 @@ class FilterStream extends Readable {
this.emit('end')
})

input.on('error', (err) => {
input.on('error', err => {
this.emit('error', err)
})

input.on('prefix', (map) => {
input.on('prefix', map => {
this.emit('prefix', map)
})
}
Expand All @@ -61,4 +59,4 @@ class FilterStream extends Readable {
}
}

module.exports = FilterStream
export default FilterStream
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "rdf-stream-filter",
"version": "1.0.0",
"description": "Filters a RDFJS Stream using a filter callback or quad pattern",
"description": "Filters a RDF/JS Stream using a filter callback or quad pattern",
"type": "module",
"main": "index.js",
"scripts": {
"test": "standard && mocha"
"test": "stricter-standard && c8 --reporter=lcov --reporter=text-summary mocha"
},
"repository": {
"type": "git",
"url": "git://github.com/rdf-ext/rdf-filter-stream.git"
"url": "https://github.com/rdf-ext/rdf-stream-filter.git"
},
"keywords": [
"rdf",
Expand All @@ -24,11 +25,13 @@
},
"homepage": "https://github.com/rdf-ext/rdf-stream-filter",
"dependencies": {
"readable-stream": "^2.2.3"
"readable-stream": "^4.5.2"
},
"devDependencies": {
"mocha": "^3.2.0",
"rdf-data-model": "^1.0.0",
"standard": "^9.0.1"
"@rdfjs/data-model": "^2.0.2",
"c8": "^9.1.0",
"mocha": "^10.4.0",
"rdf-test": "^0.1.0",
"stricter-standard": "^0.3.1"
}
}
Loading

0 comments on commit b9a7ba8

Please sign in to comment.