Comparing version 0.1.6 to 0.1.7
@@ -12,7 +12,7 @@ "use strict"; | ||
case 'string': | ||
return types_1.string.refined(value => (0, utils_1.refinement)(value === literal, value, () => `Expected string ${JSON.stringify(literal)}, getting ${JSON.stringify(value)}.`)); | ||
return types_1.string.refined(value => (0, utils_1.refinement)(value === literal, value, () => `Expected string ${JSON.stringify(literal)}, getting ${JSON.stringify(value)}.`), { const: literal }); | ||
case 'number': | ||
return types_1.number.refined(value => (0, utils_1.refinement)(value === literal, value, () => `Expected number ${literal}, getting ${value}.`)); | ||
return types_1.number.refined(value => (0, utils_1.refinement)(value === literal, value, () => `Expected number ${literal}, getting ${value}.`), { const: literal }); | ||
case 'boolean': | ||
return types_1.boolean.refined(value => (0, utils_1.refinement)(value === literal, value, () => `Expected boolean ${literal}, getting ${value}.`)); | ||
return types_1.boolean.refined(value => (0, utils_1.refinement)(value === literal, value, () => `Expected boolean ${literal}, getting ${value}.`), { const: literal }); | ||
default: | ||
@@ -19,0 +19,0 @@ throw new TypeError('Unsupported literal value'); |
@@ -8,7 +8,7 @@ import isEqual from 'lodash.isequal'; | ||
case 'string': | ||
return string.refined(value => refinement(value === literal, value, () => `Expected string ${JSON.stringify(literal)}, getting ${JSON.stringify(value)}.`)); | ||
return string.refined(value => refinement(value === literal, value, () => `Expected string ${JSON.stringify(literal)}, getting ${JSON.stringify(value)}.`), { const: literal }); | ||
case 'number': | ||
return number.refined(value => refinement(value === literal, value, () => `Expected number ${literal}, getting ${value}.`)); | ||
return number.refined(value => refinement(value === literal, value, () => `Expected number ${literal}, getting ${value}.`), { const: literal }); | ||
case 'boolean': | ||
return boolean.refined(value => refinement(value === literal, value, () => `Expected boolean ${literal}, getting ${value}.`)); | ||
return boolean.refined(value => refinement(value === literal, value, () => `Expected boolean ${literal}, getting ${value}.`), { const: literal }); | ||
default: | ||
@@ -15,0 +15,0 @@ throw new TypeError('Unsupported literal value'); |
{ | ||
"name": "x-value", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"repository": "https://github.com/vilic/x-value.git", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -32,27 +32,33 @@ import isEqual from 'lodash.isequal'; | ||
case 'string': | ||
return string.refined(value => | ||
refinement( | ||
value === literal, | ||
value, | ||
() => | ||
`Expected string ${JSON.stringify( | ||
literal, | ||
)}, getting ${JSON.stringify(value)}.`, | ||
), | ||
return string.refined( | ||
value => | ||
refinement( | ||
value === literal, | ||
value, | ||
() => | ||
`Expected string ${JSON.stringify( | ||
literal, | ||
)}, getting ${JSON.stringify(value)}.`, | ||
), | ||
{const: literal}, | ||
); | ||
case 'number': | ||
return number.refined(value => | ||
refinement( | ||
value === literal, | ||
value, | ||
() => `Expected number ${literal}, getting ${value}.`, | ||
), | ||
return number.refined( | ||
value => | ||
refinement( | ||
value === literal, | ||
value, | ||
() => `Expected number ${literal}, getting ${value}.`, | ||
), | ||
{const: literal}, | ||
); | ||
case 'boolean': | ||
return boolean.refined(value => | ||
refinement( | ||
value === literal, | ||
value, | ||
() => `Expected boolean ${literal}, getting ${value}.`, | ||
), | ||
return boolean.refined( | ||
value => | ||
refinement( | ||
value === literal, | ||
value, | ||
() => `Expected boolean ${literal}, getting ${value}.`, | ||
), | ||
{const: literal}, | ||
); | ||
@@ -59,0 +65,0 @@ default: |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
461325
8741
0