Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
LINQ-like JavaScript object query library. No dependencies. Works in all environments.
LINQ-like JavaScript object query library. No dependencies. Works in all environments.
Work in progress, stay tuned for the upcoming 1.0
.
Quick examples:
More examples...
npm install datacraft --save
JavaScript
// ESM Import ...
import DataSet from "datacraft";
// ... or CommonJS Require
const DataSet = require("datacraft");
TypeScript
Notes for TypeScript:
import DataSet from "datacraft";
const data : DataSet = new DataSet();
JavaScript
import DataSet from "https://deno.land/x/datacraft/src/datacraft.js";
const data = new DataSet();
TypeScript
import { DataSet } from "https://deno.land/x/datacraft/src/datacraft.js";
const _data : DataSet = new DataSet();
datacraft.min.js
(UMD and standalone) or datacraft.min.mjs
(ES-module) from the dist/ folderTo use as a UMD-module (stand alone, RequireJS etc.)
<script src="https://cdn.jsdelivr.net/npm/datacraft@0/dist/datacraft.min.js"></script>
To use as a ES-module
<script type="module">
import DataSet from "https://cdn.jsdelivr.net/npm/datacraft@0/dist/datacraft.min.mjs";
// ... see usage section ...
</script>
Full documentation available at hexagon.github.io/datacraft.
The short version:
// Node
// import { DataSet } from "datacraft";
// Deno
import DataSet from "https://deno.land/x/datacraft/src/datacraft.js";
// Set up data
let persons = new DataSet([
{name: "Curt", group: 14, age: 34},
{name: "Lewis", group: 14, age: 38},
{name: "Stewie", group: 15, age: 31}
]);
let groups = new DataSet([
{group: 14, name: "Western"},
{group: 15, name: "North"}
]);
// Set up relations
let personsWithFirstGroup = persons.copy().joinFirst(groups, "groups", (p, g) => p.group == g.group);
let groupsWithAllPersons = groups.copy().join(persons, "persons", (g, p) => g.group == p.group);
// Aggregate data
groupsWithAllPersons
.avg("persons", "averageAge", p => p.age)
.min("persons", "maxAge", p => p.age)
.max("persons", "minAge", p => p.age)
.count("persons", "personCount", p => p.name);
// Print data
console.log(personsWithFirstGroup.toArray());
console.log(groupsWithAllPersons.toArray());
All methods of DataSet
.
Method | Description |
---|---|
insert([obj1, obj2]) | Insert new objects into data set |
drop(fieldName) | Remove a field from all objects in data set |
copy() | Make a shallow copy of current data set |
calc(outputFieldName, calcCb) | Creates a new field, containing the return value of calcCb |
autonumber(outputFieldName) | Creates a new field, contaning a number that increment for each entry |
Method | Description |
---|---|
join(otherDataSet, newFieldName, conditionCb) | Join all objects in data set with objects of another data set where conditionsCb return true |
joinFirst(otherDataSet, newFieldName, conditionCb) | Join first object from otherDataSet with objects in current data set |
Method | Description |
---|---|
filter(conditionCb) | Keep only objects matching conditionCb |
toArray(conditionCb) | Returns an array of all entries in current data set, optionally filtered by conditionCb |
first(conditionCb) | Returns the first entry if current data set, optionally filtered by conditionCb |
Method | Description |
---|---|
groupBy(groupByFieldsInput, outputFieldName) | Group current dataset by field(s) specified by groupByFieldsInput |
total(outputFieldName) | Group current dataset, placing all entries in a new field named by parameter outputFieldName |
avg(field, outputFieldName, mapCb) | Average a value from entries in field specified by field , in a new field named by outputFieldName . mapCb points out which subfield should be averaged |
sum(field, outputFieldName, mapCb) | Like above |
min(field, outputFieldName, mapCb) | Like above |
max(field, outputFieldName, mapCb) | Like above |
countd(field, outputFieldName, mapCb) | Like above |
count(field, outputFieldName, mapCb) | Like above |
MIT
FAQs
LINQ-like JavaScript object query library. No dependencies. Works in all environments.
The npm package datacraft receives a total of 6 weekly downloads. As such, datacraft popularity was classified as not popular.
We found that datacraft demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.