@proem/variant
Advanced tools
Comparing version 0.0.19 to 0.0.21
@@ -1,15 +0,3 @@ | ||
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var array = __importStar(require("@proem/array")); | ||
/** | ||
* Returns the provided tags in an tuple. | ||
*/ | ||
function tags() { | ||
import * as array from '@proem/array'; | ||
export function tags() { | ||
var tags = []; | ||
@@ -21,13 +9,6 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
} | ||
exports.tags = tags; | ||
/** | ||
* Type guard that refine the union type to a more specific one. | ||
* | ||
* Returns true if the variant has one of the provided tags. | ||
*/ | ||
function oneOf(variant, tags) { | ||
export function oneOf(variant, tags) { | ||
return array.includes(tags, variant.type); | ||
} | ||
exports.oneOf = oneOf; | ||
function map(cases, or) { | ||
export function map(cases, or) { | ||
return function (variant) { | ||
@@ -44,12 +25,3 @@ var caseFn = cases[variant.type]; | ||
} | ||
exports.map = map; | ||
/** | ||
* Create a reducer function that takes a state value as first | ||
* argument, and a Variant as a second argument. | ||
* | ||
* Returns the provided state if no case is found. | ||
* | ||
* Works well with React's useReducer hook. | ||
*/ | ||
function reducer(caseReducers) { | ||
export function reducer(caseReducers) { | ||
return function (state, variant) { | ||
@@ -63,3 +35,2 @@ var arm = caseReducers[variant.type]; | ||
} | ||
exports.reducer = reducer; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@proem/variant", | ||
"version": "0.0.19", | ||
"version": "0.0.21", | ||
"description": "proem package for handling algebraic data types", | ||
@@ -16,13 +16,8 @@ "keywords": [ | ||
"license": "MIT", | ||
"main": "lib/index.js", | ||
"module": "esm/index.js", | ||
"types": "types/index.d.ts", | ||
"main": "lib/index.cjs.js", | ||
"module": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"directories": { | ||
"lib": "lib" | ||
}, | ||
"files": [ | ||
"types", | ||
"lib", | ||
"esm" | ||
], | ||
"publishConfig": { | ||
@@ -36,5 +31,2 @@ "access": "public" | ||
"scripts": { | ||
"build:commonjs": "tsc -b .", | ||
"build:esm": "tsc -b ./tsconfig.esm.json", | ||
"prepublishOnly": "yarn build:commonjs && yarn build:esm", | ||
"test": "echo \"Error: run tests from root\" && exit 1" | ||
@@ -46,5 +38,5 @@ }, | ||
"dependencies": { | ||
"@proem/array": "^0.0.19" | ||
"@proem/array": "^0.0.21" | ||
}, | ||
"gitHead": "f8d7a1a8ceca2ba2c39ce289e1938ba1e0aa94f1" | ||
"gitHead": "36346032a36b4dc1f2098297ada24b5501c5134b" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10351
7
91
1
+ Added@proem/array@0.0.21(transitive)
- Removed@proem/array@0.0.19(transitive)
Updated@proem/array@^0.0.21