Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Sep 7, 2021
1 parent 238e8c8 commit 6f2b24d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions source/index.ts
Expand Up @@ -4,8 +4,6 @@

import {Class, TypedArray, ObservableLike, Primitive} from './types';

export {Class, TypedArray, ObservableLike, Primitive};

const typedArrayTypeNames = [
'Int8Array',
'Uint8Array',
Expand Down Expand Up @@ -260,8 +258,7 @@ is.primitive = (value: unknown): value is Primitive => is.null_(value) || isPrim
is.integer = (value: unknown): value is number => Number.isInteger(value as number);
is.safeInteger = (value: unknown): value is number => Number.isSafeInteger(value as number);

type ObjectKey = string | number | symbol;
is.plainObject = <Value = unknown>(value: unknown): value is Record<ObjectKey, Value> => {
is.plainObject = <Value = unknown>(value: unknown): value is Record<PropertyKey, Value> => {
// From: https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
if (toString.call(value) !== '[object Object]') {
return false;
Expand Down Expand Up @@ -504,7 +501,7 @@ interface Assert {
primitive: (value: unknown) => asserts value is Primitive;
integer: (value: unknown) => asserts value is number;
safeInteger: (value: unknown) => asserts value is number;
plainObject: <Value = unknown>(value: unknown) => asserts value is Record<ObjectKey, Value>;
plainObject: <Value = unknown>(value: unknown) => asserts value is Record<PropertyKey, Value>;
typedArray: (value: unknown) => asserts value is TypedArray;
arrayLike: <T = unknown>(value: unknown) => asserts value is ArrayLike<T>;
domElement: (value: unknown) => asserts value is HTMLElement;
Expand Down Expand Up @@ -601,7 +598,7 @@ export const assert: Assert = {
primitive: (value: unknown): asserts value is Primitive => assertType(is.primitive(value), AssertionTypeDescription.primitive, value),
integer: (value: unknown): asserts value is number => assertType(is.integer(value), AssertionTypeDescription.integer, value),
safeInteger: (value: unknown): asserts value is number => assertType(is.safeInteger(value), AssertionTypeDescription.safeInteger, value),
plainObject: <Value = unknown>(value: unknown): asserts value is Record<ObjectKey, Value> => assertType(is.plainObject(value), AssertionTypeDescription.plainObject, value),
plainObject: <Value = unknown>(value: unknown): asserts value is Record<PropertyKey, Value> => assertType(is.plainObject(value), AssertionTypeDescription.plainObject, value),
typedArray: (value: unknown): asserts value is TypedArray => assertType(is.typedArray(value), AssertionTypeDescription.typedArray, value),
arrayLike: <T = unknown>(value: unknown): asserts value is ArrayLike<T> => assertType(is.arrayLike(value), AssertionTypeDescription.arrayLike, value),
domElement: (value: unknown): asserts value is HTMLElement => assertType(is.domElement(value), AssertionTypeDescription.domElement, value),
Expand Down Expand Up @@ -662,6 +659,8 @@ Object.defineProperties(assert, {

export default is;

export {Class, TypedArray, ObservableLike, Primitive} from './types';

// For CommonJS default export support
module.exports = is;
module.exports.default = is;
Expand Down

0 comments on commit 6f2b24d

Please sign in to comment.