@comunica/mediator-number
Advanced tools
Comparing version 1.13.0 to 1.14.0
15
index.js
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./lib/MediatorNumber")); | ||
__exportStar(require("./lib/MediatorNumber"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { Actor, IAction, IActorOutput, IActorReply, IActorTest, IMediatorArgs, Mediator } from "@comunica/core"; | ||
import { Actor, IAction, IActorOutput, IActorReply, IActorTest, Mediator, IMediatorArgs } from '@comunica/core'; | ||
/** | ||
@@ -3,0 +3,0 @@ * A mediator that can mediate over a single number field. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MediatorNumber = void 0; | ||
const core_1 = require("@comunica/core"); | ||
@@ -23,14 +24,14 @@ /** | ||
case MediatorNumber.MIN: | ||
return (tests) => tests.reduce((a, b, i) => { | ||
const val = this.getOrDefault(b[this.field], Infinity); | ||
return val !== null && (isNaN(a[0]) || a[0] > val) ? [val, i] : a; | ||
return (tests) => tests.reduce((prev, curr, i) => { | ||
const val = this.getOrDefault(curr[this.field], Infinity); | ||
return val !== null && (isNaN(prev[0]) || prev[0] > val) ? [val, i] : prev; | ||
}, [NaN, -1])[1]; | ||
case MediatorNumber.MAX: | ||
return (tests) => tests.reduce((a, b, i) => { | ||
const val = this.getOrDefault(b[this.field], -Infinity); | ||
return val !== null && (isNaN(a[0]) || a[0] < val) ? [val, i] : a; | ||
return (tests) => tests.reduce((prev, curr, i) => { | ||
const val = this.getOrDefault(curr[this.field], -Infinity); | ||
return val !== null && (isNaN(prev[0]) || prev[0] < val) ? [val, i] : prev; | ||
}, [NaN, -1])[1]; | ||
default: | ||
throw new Error(`No valid "type" value was given, must be either ${MediatorNumber.MIN} or ${MediatorNumber.MAX}, but got: ${this.type}`); | ||
} | ||
throw new Error('No valid "type" value was given, must be either ' | ||
+ MediatorNumber.MIN + ' or ' + MediatorNumber.MAX + ', but got: ' + this.type); | ||
} | ||
@@ -46,3 +47,3 @@ getOrDefault(value, defaultValue) { | ||
dummy[this.field] = null; | ||
promises = promises.map((p) => p.catch((error) => { | ||
promises = promises.map(promise => promise.catch(error => { | ||
errors.push(error); | ||
@@ -55,4 +56,3 @@ return dummy; | ||
if (index < 0) { | ||
throw new Error('All actors rejected their test in ' + this.name + '\n' | ||
+ errors.map((e) => e.toString()).join('\n')); | ||
throw new Error(`All actors rejected their test in ${this.name}\n${errors.map(error => error.message).join('\n')}`); | ||
} | ||
@@ -63,6 +63,6 @@ return testResults[index].actor; | ||
exports.MediatorNumber = MediatorNumber; | ||
MediatorNumber.MIN = "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/mediator-number/" + | ||
"Mediator/Number/type/TypeMin"; | ||
MediatorNumber.MAX = "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/mediator-number/" + | ||
"Mediator/Number/type/TypeMax"; | ||
MediatorNumber.MIN = 'https://linkedsoftwaredependencies.org/bundles/npm/@comunica/mediator-number/' + | ||
'Mediator/Number/type/TypeMin'; | ||
MediatorNumber.MAX = 'https://linkedsoftwaredependencies.org/bundles/npm/@comunica/mediator-number/' + | ||
'Mediator/Number/type/TypeMax'; | ||
//# sourceMappingURL=MediatorNumber.js.map |
{ | ||
"name": "@comunica/mediator-number", | ||
"version": "1.13.0", | ||
"version": "1.14.0", | ||
"description": "A mediator for a single mediation number value", | ||
@@ -39,3 +39,3 @@ "lsd:module": "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/mediator-number", | ||
"devDependencies": { | ||
"@comunica/core": "^1.13.0" | ||
"@comunica/core": "^1.14.0" | ||
}, | ||
@@ -45,3 +45,3 @@ "jest": { | ||
"ts-jest": { | ||
"tsConfig": "test/tsconfig.json" | ||
"tsConfig": "../../tsconfig.json" | ||
} | ||
@@ -62,7 +62,6 @@ }, | ||
"test-watch": "node \"../../node_modules/jest/bin/jest.js\" ${1} --watch", | ||
"lint": "node \"../../node_modules/tslint/bin/tslint\" lib/**/*.ts test/**/*.ts --exclude '**/*.d.ts'", | ||
"build": "node \"../../node_modules/typescript/bin/tsc\"", | ||
"validate": "npm ls" | ||
}, | ||
"gitHead": "cd8df73fe091e3d7413147ec5301b47be2de392a" | ||
"gitHead": "6517367d95ef072468bfc0d88cf3a27f6d25a145" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13865
117