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.
@lopatnov/join
Advanced tools
Object join technics.
npm install @lopatnov/join
<script src="https://lopatnov.github.io/join/dist/join.min.js"></script>
import { join, JoinTypes } from "@lopatnov/join";
var library = require("@lopatnov/join");
var join = library.join;
var JoinTypes = library.JoinTypes;
enum JoinTypes {
none = 0b0000,
left = 0b1000, // take unique left object properties
right = 0b0001, // take unique right object properties
innerLeft = 0b0100, // take non-unique (inner) properties from left object
innerRight = 0b0010, // take non-unique (inner) properties from right object
innerJoin = none | innerLeft | innerRight | none, // innerLeft + innerRight = deep merge inner join of two objects
leftJoin = left | innerLeft | innerRight | none,
rightJoin = none | innerLeft | innerRight | right,
fullJoin = left | innerLeft | innerRight | right,
expand = left | none | innerRight | right
}
JoinTypes.expand
is default join type
// 1. Set join Type
function join(joinType?: JoinTypes) => (local function)<TContext>(context: TContext)
// 2. Set context (left object)
(local function)<TContext>(context: TContext) => (local function)<TJoinObject>(joinObject: TJoinObject)
// 3. Set join object (right object) and gets result
(local function)<TJoinObject>(joinObject: TJoinObject): TContext & TJoinObject
const rightJoin = join(JoinTypes.right);
const contextJoinBy = rightJoin({
sample1: "One",
sample2: "Two",
sample3: "Three",
});
const result = contextJoinBy({
sample2: "Dos",
sample3: "Tres",
sample4: "Quatro",
});
console.log(result); // { sample4: "Quatro" }
const leftJoin = join(JoinTypes.left);
const contextJoinBy = leftJoin({
sample1: "One",
sample2: "Two",
sample3: "Three",
});
const result = contextJoinBy({
sample2: "Dos",
sample3: "Tres",
sample4: "Quatro",
});
console.log(result); // { sample1: "One" }
const complexJoin = join(JoinTypes.left | JoinTypes.innerLeft | JoinTypes.right);
const contextJoinBy = complexJoin({
sample1: "One",
sample2: "Two",
sample3: "Three",
});
const result = contextJoinBy({
sample2: "Dos",
sample3: "Tres",
sample4: "Quatro",
});
console.log(result); // {sample1: "One", sample2: "Two", sample3: "Three", sample4: "Quatro"}
const result = join(JoinTypes.innerJoin)({
sample1: "One",
sample2: "Two",
sample3: {
smile: "cheese",
},
})({
sample2: "Dos",
sample3: {
sorrir: "queijo",
},
sample4: "Quatro",
});
console.log(result); // {sample2: "Dos", sample3: {smile: "cheese", sorrir: "queijo"}}
See, how it's working: https://runkit.com/lopatnov/join
Test it with a runkit: https://npm.runkit.com/@lopatnov/join
License Apache-2.0
Copyright 2020–2021 Oleksandr Lopatnov
FAQs
Object join technics
The npm package @lopatnov/join receives a total of 0 weekly downloads. As such, @lopatnov/join popularity was classified as not popular.
We found that @lopatnov/join 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.