Comparing version 1.4.1 to 1.4.2
@@ -28,4 +28,4 @@ 'use strict'; | ||
function assertNever(condition) { | ||
throw new Error("Unexpected call to assertNever: '".concat(condition, "'")); | ||
function assertNever(arg) { | ||
throw new Error('Expected never to be called, but received: ' + JSON.stringify(arg)); | ||
} | ||
@@ -32,0 +32,0 @@ /** |
@@ -28,4 +28,4 @@ 'use strict'; | ||
function assertNever(condition) { | ||
throw new Error("Unexpected call to assertNever: '".concat(condition, "'")); | ||
function assertNever(arg) { | ||
throw new Error('Expected never to be called, but received: ' + JSON.stringify(arg)); | ||
} | ||
@@ -32,0 +32,0 @@ /** |
@@ -24,4 +24,4 @@ /** | ||
function assertNever(condition) { | ||
throw new Error("Unexpected call to assertNever: '".concat(condition, "'")); | ||
function assertNever(arg) { | ||
throw new Error('Expected never to be called, but received: ' + JSON.stringify(arg)); | ||
} | ||
@@ -28,0 +28,0 @@ /** |
@@ -13,3 +13,3 @@ /** | ||
*/ | ||
export declare function assertNever(condition: never): never; | ||
export declare function assertNever(arg: never): never; | ||
/** | ||
@@ -16,0 +16,0 @@ * Similar to `assert` but only logs a warning if the condition is not met. Only |
@@ -14,3 +14,3 @@ /// <reference lib="es2020.promise" /> | ||
/** Checks whether or not an array is empty. */ | ||
export declare function isNonEmptyArray<T>(value: T[]): value is [T, ...T[]]; | ||
export declare function isNonEmptyArray<T>(value: readonly T[]): value is [T, ...T[]]; | ||
/** Checks whether a value is null or undefined */ | ||
@@ -17,0 +17,0 @@ export declare function isNullish(value: unknown): value is Nullish; |
{ | ||
"name": "emery", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "Utilities to help polish the rough parts of TypeScript.", | ||
@@ -5,0 +5,0 @@ "main": "dist/emery.cjs.js", |
@@ -59,3 +59,3 @@ import { assert, assertNever, warning } from './assertions'; | ||
} catch (error) { | ||
expect(getErrorMessage(error)).toBe(`Unexpected call to assertNever: '${value}'`); | ||
expect(getErrorMessage(error)).toBe(`Expected never to be called, but received: ${value}`); | ||
} | ||
@@ -62,0 +62,0 @@ }); |
@@ -22,4 +22,4 @@ /** | ||
*/ | ||
export function assertNever(condition: never): never { | ||
throw new Error(`Unexpected call to assertNever: '${condition}'`); | ||
export function assertNever(arg: never): never { | ||
throw new Error('Expected never to be called, but received: ' + JSON.stringify(arg)); | ||
} | ||
@@ -26,0 +26,0 @@ |
@@ -68,3 +68,5 @@ import { | ||
expect(isNonEmptyArray([1, 2])).toBe(true); | ||
expect(isNonEmptyArray([1, 2] as const)).toBe(true); | ||
expect(isNonEmptyArray([])).toBe(false); | ||
expect(isNonEmptyArray([] as const)).toBe(false); | ||
}); | ||
@@ -71,0 +73,0 @@ }); |
@@ -36,3 +36,3 @@ /// <reference lib="es2020.promise" /> | ||
/** Checks whether or not an array is empty. */ | ||
export function isNonEmptyArray<T>(value: T[]): value is [T, ...T[]] { | ||
export function isNonEmptyArray<T>(value: readonly T[]): value is [T, ...T[]] { | ||
return value.length > 0; | ||
@@ -39,0 +39,0 @@ } |
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
78095
1773