![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
call-context
Advanced tools
This package provides a simple call-stack context provision.
import { context } from "call-context";
const ctx = context("my context"); // name is optional
const fn = () => {
console.log(ctx.require()); // we'll provide 42, so this will log 42.
};
const contextProvidedFn = ctx.provide(42)(fn);
contextProvidedFn();
Context's require()
will throw an error if the context has not been provided.
Name your context at construction time so that you get a meaningful error
message.
Use provide
.
import { provide } from "call-context";
const contextProvidedFn =
provide(context1, value1)(context2, value2)(context3, value3)(fn);
Use get
to consume the context optionally. This returns undefined
if the
context has not been provided.
import { context } from "call-context";
const ctx = context("my context"); // name is optional
const fn = () => {
console.log(ctx.get() ?? 42); // This will log 42 without provision.
};
fn();
Using call-stack context allows dependencies to be provided deep in the call hierarchy. This idea is inspired from React's conext, which allows dependencies to be provided deep in the component hierarchy. Context allows for more liberal use of dependency inversion, because it reduces the amount of pumbling required to send the dependencies to the use site.
The alternative, i.e. passing dependencies down the call hierarchy, has better traceability.
FAQs
A context provision tool.
The npm package call-context receives a total of 0 weekly downloads. As such, call-context popularity was classified as not popular.
We found that call-context 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.