![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@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 2 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.