
Security News
libxml2 Maintainer Ends Embargoed Vulnerability Reports, Citing Unsustainable Burden
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
github.com/ldflex/async-iteration-handlers
This library acts as a wrapper for functions from the async library, exporting them as handlers to be used by LDflex.
defaultIterationHandlers
)const { PathFactory, defaultHandlers } = require('ldflex');
const { default: ComunicaEngine } = require('@ldflex/comunica');
const { default: defaultIterationHandlers } = require('@ldflex/async-iteration-handlers');
const { namedNode } = require('@rdfjs/data-model');
// The JSON-LD context for resolving properties
const context = {
"@context": {
"@vocab": "http://xmlns.com/foaf/0.1/",
"friends": "knows",
"label": "http://www.w3.org/2000/01/rdf-schema#label",
}
};
// The query engine and its source
const queryEngine = new ComunicaEngine('https://ruben.verborgh.org/profile/');
// The object that can create new paths
const path = new PathFactory({
context,
queryEngine,
handlers: {
...defaultHandlers,
...defaultIterationHandlers
}
});
const ruben = path.create({ subject: namedNode('https://ruben.verborgh.org/profile/#me') });
ruben.friends.forEach(async (x: any) => {
console.log(`${await x}`)
});
.every
.everyLimit
.everySeries
// This executes asynchronously
const allFriendsLabelled: Promise<boolean> = path.friends.every(
async friend => `${await friend.label}` !== 'undefined'
);
// This executes synchronously
const allFriendsLabelled: Promise<boolean> = path.friends.everySeries(
async friend => `${await friend.label}` !== 'undefined'
);
// This executes asynchronously, but at most 5 entities are processed in parrallel at any time
const allFriendsLabelled: Promise<boolean> = path.friends.everyLimit(
async friend => `${await friend.label}` !== 'undefined',
5
);
.filter
.filterLimit
.filterSeries
// This executes asynchronously
const labelledFriends: Promise<string[]> = path.friends.filter(
async friend => `${await friend.label}` !== 'undefined'
);
// This executes synchronously
const labelledFriends: Promise<string[]> = path.friends.filterSeries(
async friend => `${await friend.label}` !== 'undefined'
);
// This executes asynchronously, but at most 5 entities are processed in parrallel at any time
const labelledFriends: Promise<string[]> = path.friends.filterLimit(
async friend => `${await friend.label}` !== 'undefined',
5
);
.find
.findLimit
.findSeries
// This executes asynchronously
const labelledFriend: Promise<string> = path.friends.find(
async friend => `${await friend.label}` !== 'undefined'
);
// This executes synchronously
const labelledFriend: Promise<string> = path.friends.findSeries(
async friend => `${await friend.label}` !== 'undefined'
);
// This executes asynchronously, but at most 5 entities are processed in parrallel at any time
const labelledFriend: Promise<string> = path.friends.findLimit(
async friend => `${await friend.label}` !== 'undefined',
5
);
.forEach
.forEachLimit
.forEachSeries
const labelledFriend = [];
// This executes asynchronously
path.friends.forEach(
async friend => {
if (`${await friend.label}` !== 'undefined') {
labelledFriend.push(friend)
}
}
);
// This executes synchronously
path.friends.forEachSeries(
async friend => {
if (`${await friend.label}` !== 'undefined') {
labelledFriend.push(friend)
}
}
);
// This executes asynchronously, but at most 5 entities are processed in parrallel at any time
path.friends.forEachLimit(
async friend => {
if (`${await friend.label}` !== 'undefined') {
labelledFriend.push(friend)
}
},
5
);
.forEachOf
.forEachOfLimit
.forEachOfSeries
const labelledFriend = [];
// This executes asynchronously
path.friends.forEachOf(
async (friend, index) => {
if (`${await friend.label}` !== 'undefined') {
labelledFriend.push(friend)
}
}
);
// This executes synchronously
path.friends.forEachOfSeries(
async (friend, index) => {
if (`${await friend.label}` !== 'undefined') {
labelledFriend.push(friend)
}
}
);
// This executes asynchronously, but at most 5 entities are processed in parrallel at any time
path.friends.forEachOfLimit(
async (friend, index) => {
if (`${await friend.label}` !== 'undefined') {
labelledFriend.push(friend)
}
},
5
);
.map
.mapLimit
.mapSeries
// This executes asynchronously
const friendLabels: Promise<string[]> = path.friends.map(
async friend => `${await friend.label}`
);
// This executes synchronously
const friendLabels: Promise<string[]> = path.friends.mapSeries(
async friend => `${await friend.label}`
);
// This executes asynchronously, but at most 5 entities are processed in parrallel at any time
const friendLabels: Promise<string[]> = path.friends.mapLimit(
async friend => `${await friend.label}`,
5
);
.some
.someLimit
.someSeries
// This executes asynchronously
const someFriendsLabelled: Promise<boolean> = path.friends.some(
friend => `${friend.label}` !== 'undefined'
);
// This executes synchronously
const someFriendsLabelled: Promise<boolean> = path.friends.someLimit(
friend => `${friend.label}` !== 'undefined'
);
// This executes asynchronously, but at most 5 entities are processed in parrallel at any time
const someFriendsLabelled: Promise<boolean> = path.friends.someSeries(
friend => `${friend.label}` !== 'undefined',
5
);
.reduce
// This executes synchronously
const friendLabels: Promise<string>= path.friends.reduce(
async (total, friend) => `${total}&${await friend.label}`,
''
);
seriesIterationHandlers
)const { PathFactory } = require('ldflex');
const { default: ComunicaEngine, defaultHandlers } = require('@ldflex/comunica');
const { seriesIterationHandlers } = require('@ldflex/async-iteration-handlers');
const { namedNode } = require('@rdfjs/data-model');
// The JSON-LD context for resolving properties
const context = {
"@context": {
"@vocab": "http://xmlns.com/foaf/0.1/",
"friends": "knows",
"label": "http://www.w3.org/2000/01/rdf-schema#label",
}
};
// The query engine and its source
const queryEngine = new ComunicaEngine('https://ruben.verborgh.org/profile/');
// The object that can create new paths
const path = new PathFactory({
context,
queryEngine,
handlers: [
...defaultHandlers,
...seriesIterationHandlers
]
});
.every
// This executes synchronously
const allFriendsLabelled: Promise<boolean> = path.friends.every(
async friend => `${await friend.label}` !== 'undefined'
);
.filter
// This executes synchronously
const labelledFriends: Promise<string[]> = path.friends.filter(
async friend => `${await friend.label}` !== 'undefined'
);
.find
// This executes synchronously
const labelledFriend: Promise<string> = path.friends.find(
async friend => `${await friend.label}` !== 'undefined'
);
.forEach
const labelledFriend = [];
// This executes synchronously
path.friends.forEach(
async friend => {
if (`${await friend.label}` !== 'undefined') {
labelledFriend.push(friend)
}
}
);
.forEachOf
const labelledFriend = [];
// This executes synchronously
path.friends.forEachOf(
async (friend, index) => {
if (`${await friend.label}` !== 'undefined') {
labelledFriend.push(friend)
}
}
);
.map
// This executes synchronously
const friendLabels: Promise<string[]> = path.friends.map(
async friend => `${await friend.label}`
);
.some
// This executes synchronously
const someFriendsLabelled: Promise<boolean> = path.friends.some(
friend => `${friend.label}` !== 'undefined'
);
.reduce
// This executes synchronously
const friendLabels: Promise<string>= path.friends.reduce(
async (total, friend) => `${total}&${await friend.label}`,
''
);
By default, methods with limited asynchronicity process at most 5 entities concurrently.
©2020–present Jesse Wright, Ruben Verborgh, Ruben Taelman. MIT License.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.