Skip to content

Commit

Permalink
update to current node LTS releases and using ES module
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsouth committed Jun 17, 2024
1 parent 21c0cb7 commit a389d5a
Show file tree
Hide file tree
Showing 5 changed files with 649 additions and 510 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejsci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x]
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v2
Expand Down
28 changes: 14 additions & 14 deletions lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const union = function(A, B) {
// * The term "defeats" is widely used in the supporting literature, but it may
// not be the best word to use, as it suggests a resolved struggle. Alternative
// terms that could be used here include "attack" and "conflict with".
class ArgumentFramework {
export class ArgumentFramework {
// defeatermap: object whose keys are arguments and whose values are arrays of defeating arguments
constructor(defeatermap) {
this.defeatermap = defeatermap || {};
Expand Down Expand Up @@ -221,7 +221,7 @@ class ArgumentFramework {
// A Labelling consists of three mutually distinct argument sets, "in", "out" and "undec"
// TODO: Sort arrays on construction? (not unless you sort on insertion)
// TODO: Link a Labelling to an ArgumentFramework? (thus removing need for parameter in illegallyIn and illegallyOut functions and allowing for possibility of the argument framework changing after labelling was constructed)
class Labelling {
export class Labelling {
constructor(ins, outs, undecs) {
this.in = ins || [];
this.out = outs || [];
Expand Down Expand Up @@ -315,7 +315,7 @@ class Labeller {
}

// a particularly sceptical semantics that returns a single labelling
class GroundedLabeller extends Labeller {
export class GroundedLabeller extends Labeller {
// see pages 16/17 of Caminada's Gentle Introduction and
// and section 4.1 of Modgil and Caminada
// start with an all undec labelling and iteratively push arguments
Expand Down Expand Up @@ -352,7 +352,7 @@ class GroundedLabeller extends Labeller {
}

// A credulous semantics that can return multiple labellings
class PreferredLabeller extends Labeller {
export class PreferredLabeller extends Labeller {
// see section 5.1 fo Modgil and Caminada 2009
labellings() {
const checkIn = labelling => {
Expand Down Expand Up @@ -437,15 +437,15 @@ class PreferredLabeller extends Labeller {
}

// Stable extensions are preferred extensions that defeat all other arguments in a framework
class StableSemantics extends PreferredLabeller {
export class StableSemantics extends PreferredLabeller {
// Filter the labellings based on those that have empty undec
extensions() {
return this.labellings().filter((labelling) => labelling.undec.length === 0).map((labelling) => labelling.in);
}
}

// Ideal semantics yields a single extension that can be less sceptical than grounded
class IdealSemantics extends PreferredLabeller {
export class IdealSemantics extends PreferredLabeller {
// Return the maximal admissible subset of all the preferred extensions
extensions() {
// start with all args
Expand All @@ -461,11 +461,11 @@ class IdealSemantics extends PreferredLabeller {
}
}

// exports is used in the context of npm, window in the browser
const root = typeof exports !== 'undefined' && exports !== null ? exports : window;
root.ArgumentFramework = ArgumentFramework;
root.Labelling = Labelling;
root.GroundedLabeller = GroundedLabeller;
root.PreferredLabeller = PreferredLabeller;
root.StableSemantics = StableSemantics;
root.IdealSemantics = IdealSemantics;
// // exports is used in the context of npm, window in the browser
// const root = typeof exports !== 'undefined' && exports !== null ? exports : window;
// root.ArgumentFramework = ArgumentFramework;
// root.Labelling = Labelling;
// root.GroundedLabeller = GroundedLabeller;
// root.PreferredLabeller = PreferredLabeller;
// root.StableSemantics = StableSemantics;
// root.IdealSemantics = IdealSemantics;
Loading

0 comments on commit a389d5a

Please sign in to comment.