Comparing version 3.1.0-dev-f30a30 to 4.0.0
@@ -9,2 +9,5 @@ 'use strict'; | ||
var EMPTY_CONTEXT = Symbol(); | ||
/** | ||
* Base context interface. | ||
*/ | ||
function createContext(defaultContextValue) { | ||
@@ -35,2 +38,6 @@ var contextValue = EMPTY_CONTEXT; | ||
} | ||
/** | ||
* Cascading context - another implementation of context, that assumes the context value is an object. | ||
* When nesting context runs, the the values of the current layer merges with the layers above it. | ||
*/ | ||
function createCascade(init) { | ||
@@ -37,0 +44,0 @@ var ctx = createContext(); |
@@ -5,2 +5,5 @@ import { invariant, defaultTo, assign, optionalFunctionValue } from 'vest-utils'; | ||
var EMPTY_CONTEXT = Symbol(); | ||
/** | ||
* Base context interface. | ||
*/ | ||
function createContext(defaultContextValue) { | ||
@@ -31,2 +34,6 @@ var contextValue = EMPTY_CONTEXT; | ||
} | ||
/** | ||
* Cascading context - another implementation of context, that assumes the context value is an object. | ||
* When nesting context runs, the the values of the current layer merges with the layers above it. | ||
*/ | ||
function createCascade(init) { | ||
@@ -33,0 +40,0 @@ var ctx = createContext(); |
@@ -9,2 +9,5 @@ (function (global, factory) { | ||
var EMPTY_CONTEXT = Symbol(); | ||
/** | ||
* Base context interface. | ||
*/ | ||
function createContext(defaultContextValue) { | ||
@@ -35,2 +38,6 @@ var contextValue = EMPTY_CONTEXT; | ||
} | ||
/** | ||
* Cascading context - another implementation of context, that assumes the context value is an object. | ||
* When nesting context runs, the the values of the current layer merges with the layers above it. | ||
*/ | ||
function createCascade(init) { | ||
@@ -37,0 +44,0 @@ var ctx = createContext(); |
{ | ||
"version": "3.1.0-dev-f30a30", | ||
"version": "4.0.0", | ||
"license": "MIT", | ||
@@ -14,3 +14,3 @@ "main": "./dist/cjs/context.js", | ||
"dependencies": { | ||
"vest-utils": "^0.1.0-dev-f30a30" | ||
"vest-utils": "^0.0.5" | ||
}, | ||
@@ -40,3 +40,3 @@ "module": "./dist/es/context.production.js", | ||
"./package.json": "./package.json", | ||
"./": "./" | ||
"./*": "./*" | ||
}, | ||
@@ -43,0 +43,0 @@ "repository": { |
@@ -1,3 +0,5 @@ | ||
# Context | ||
# Context 🪆 | ||
[![Join Discord](https://badgen.net/discord/online-members/WmADZpJnSe?icon=discord&label=Discord)](https://discord.gg/WmADZpJnSe) [![Version](https://badgen.net/npm/v/vest?&icon=npm)](https://www.npmjs.com/package/context) [![Downloads](https://badgen.net/npm/dt/context?label=Downloads)](https://www.npmjs.com/package/context) [![bundlephobia](https://badgen.net/bundlephobia/minzip/context)](https://bundlephobia.com/package/context) [![Status](https://badgen.net/github/status/ealush/vest)](https://github.com/ealush/vest/actions) | ||
Simple utility for context propagation within Javascript applications and libraries. Loosely based on the ideas behind React's context, allows you to achieve the same goals (and more) without actually using react. | ||
@@ -4,0 +6,0 @@ It allows you to keep reference for shared variables, and access them down in your function call even if not declared in the same scope. |
@@ -6,4 +6,4 @@ { | ||
"baseUrl": ".", | ||
"declarationDir": "./types", | ||
"declarationMap": true, | ||
"declarationDir": "./types", | ||
"outDir": "./dist", | ||
@@ -10,0 +10,0 @@ "paths": { |
import { CB } from 'vest-utils'; | ||
/** | ||
* Base context interface. | ||
*/ | ||
declare function createContext<T extends unknown>(defaultContextValue?: T): CtxApi<T>; | ||
/** | ||
* Cascading context - another implementation of context, that assumes the context value is an object. | ||
* When nesting context runs, the the values of the current layer merges with the layers above it. | ||
*/ | ||
declare function createCascade<T extends Record<string, unknown>>(init?: (value: Partial<T>, parentContext: T | void) => T | null): CtxCascadeApi<T>; | ||
@@ -4,0 +11,0 @@ type ContextConsumptionApi<T> = { |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
25634
246
3
215
+ Addedvest-utils@0.0.5(transitive)
- Removedvest-utils@0.1.1(transitive)
Updatedvest-utils@^0.0.5