Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

extra-utils

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extra-utils - npm Package Compare versions

Comparing version 3.5.1 to 3.6.0

lib/array/index.d.ts

15

lib/index.d.ts
export * from './array';
export * from './bigint';
export * from './boolean';
export * from './date';
export * from './enum';
export * from './function';
export * from './nullish';
export * from './number';
export * from './object';
export * from './json';
export * from './string';
export * from './nullish';
export * from './in-enum';
export * from './is-regexp';
export * from './is-symbol';
export * from './is-date';
export * from './is-function';
export * from './pipe';
export * from './string';
export * from './regexp';
export * from './symbol';

@@ -18,15 +18,14 @@ "use strict";

__exportStar(require("./array"), exports);
__exportStar(require("./bigint"), exports);
__exportStar(require("./boolean"), exports);
__exportStar(require("./date"), exports);
__exportStar(require("./enum"), exports);
__exportStar(require("./function"), exports);
__exportStar(require("./nullish"), exports);
__exportStar(require("./number"), exports);
__exportStar(require("./object"), exports);
__exportStar(require("./json"), exports);
__exportStar(require("./string"), exports);
__exportStar(require("./nullish"), exports);
__exportStar(require("./in-enum"), exports);
__exportStar(require("./is-regexp"), exports);
__exportStar(require("./is-symbol"), exports);
__exportStar(require("./is-date"), exports);
__exportStar(require("./is-function"), exports);
__exportStar(require("./pipe"), exports);
__exportStar(require("./string"), exports);
__exportStar(require("./regexp"), exports);
__exportStar(require("./symbol"), exports);
//# sourceMappingURL=index.js.map
{
"name": "extra-utils",
"version": "3.5.1",
"version": "3.6.0",
"description": "Utilities for JavaScript and Typescript",

@@ -5,0 +5,0 @@ "files": [

@@ -12,90 +12,43 @@ # extra-utils

## API
### pipe
### Array
```ts
function pipe<A, B, C, D, E, F, G, H>(
value: A
, ...operators: [
(value: A) => B
, (value: B) => C
, (value: C) => D
, (value: D) => E
, (value: E) => F
, (value: F) => G
, (value: G) => H
]
): H
function pipe<A, B, C, D, E, F, G>(
value: A
, ...operators: [
(value: A) => B
, (value: B) => C
, (value: C) => D
, (value: D) => E
, (value: E) => F
, (value: F) => G
]
): G
function pipe<A, B, C, D, E, F>(
value: A
, ...operators: [
(value: A) => B
, (value: B) => C
, (value: C) => D
, (value: D) => E
, (value: E) => F
]
): F
function pipe<A, B, C, D, E>(
value: A
, ...operators: [
(value: A) => B
, (value: B) => C
, (value: C) => D
, (value: D) => E
]
): E
function pipe<A, B, C, D>(
value: A
, ...operators: [
(value: A) => B
, (value: B) => C
, (value: C) => D
]
): D
function pipe<A, B, C>(
value: A
, ...operators: [
(value: A) => B
, (value: B) => C
]
): C
function pipe<A, B>(
value: A
, ...operators: [
(value: A) => B
]
): B
function pipe<T, U>(
value: T
, ...operators: Array<(value: unknown) => unknown>
): U
function isArray<T>(val: unknown): val is Array<T>
function isntArray<T>(val: T): val is Exclude<T, Array<unknown>>
function isEmptyArray(val: unknown[]): boolean
function isntEmptyArray<T>(val: T[]): val is NonEmptyArray<T>
```
### Enum
### Boolean
```ts
function inEnum<T>(val: unknown, _enum: object): val is T
function notInEnum<T, U>(val: T, _enum: object): val is Exclude<T, U>
function isBoolean(val: unknown): val is boolean
function isntBoolean<T>(val: unknown): val is Exclude<T, boolean>
function isFalsy(val: unknown): val is Falsy
function isntFalsy<T>(val: T): val is Exclude<T, Falsy>
```
### Array
### JSON
```ts
function isArray<T>(val: unknown): val is Array<T>
function isntArray<T>(val: T): val is Exclude<T, Array<unknown>>
function isJson(val: unknown): Json
function isntJson<T>(val: T): val is Exclude<T, Json>
function isEmptyArray(val: unknown[]): boolean
function isntEmptyArray<T>(val: T[]): val is NonEmptyArray<T>
function isJsonable<T extends Json>(val: unknown): val is Jsonable<T>
function isntJsonable<T>(val: T): val is Exclude<T, Jsonable<Json>>
```
### Number, BigInt
### Nullish
```ts
function isNullish(val: unknown): val is Nullish
function isntNullish<T>(val: T): val is Exclude<T, Nullish>
function isNull(val: unknown): val is null
function isntNull<T>(val: T): val is Exclude<T, null>
function isUndefined(val: unknown): val is undefined
function isntUndefined<T>(val: T): val is Exclude<T, undefined>
```
### Number
```ts
function isNumber(val: unknown): val is number

@@ -115,8 +68,20 @@ function isntNumber<T>(val: T): val is Exclude<T, number>

### Boolean
### Object
```ts
function isBoolean(val: unknown): val is boolean
function isObject(
val: unknown
): val is object & Record<string | symbol | number, unknown>
function isntObject<T>(
val: T
): val is Exclude<T, object & Record<string | symbol | number, unknown>>
function isFalsy(val: unknown): val is Falsy
function isntFalsy<T>(val: T): val is Exclude<T, Falsy>
function isPlainObject(
val: unknown
): val is object & Record<string | symbol | number, unknown>
function isntPlainObject<T>(
val: T
): val is Exclude<T, object & Record<string | symbol | number, unknown>>
function isEmptyObject(val: object): boolean
function isntEmptyObject(val: object): boolean
```

@@ -136,57 +101,93 @@

### Date
#### removeExtraIndents
```ts
function isDate(val: unknown): val is Date
function isntDate<T>(val: T): val is Exclude<T, Date>
function removeExtraIndents(
text: string
, options?: { ignoreBlankLines: boolean = false }
): string
```
### Function
Example:
```ts
function isFunction<T extends Function = (...args: any[]) => any>(
val: unknown
): val is T
function isntFunction<T>(val: T): val is Exclude<T, Function>
removeExtraIndents(`
hello
world
`, { ignoreBlankLines: true })
// '\n'
// + 'hello' + '\n'
// + '\n'
// + 'world' + '\n'
```
### Nullish
#### removeBlankLines
```ts
function isNullish(val: unknown): val is Nullish
function isntNullish<T>(val: T): val is Exclude<T, Nullish>
function removeBlankLines(text: string): string
```
function isNull(val: unknown): val is null
function isntNull<T>(val: T): val is Exclude<T, null>
Example:
```ts
removeBlankLines(
'\n'
+ 'hello' + '\n'
+ '\n'
+ 'world' + '\n'
+ '\n'
)
// 'hello' + '\n'
// + 'world'
```
function isUndefined(val: unknown): val is undefined
function isntUndefined<T>(val: T): val is Exclude<T, undefined>
#### removeLeadingBlankLines
```ts
function removeLeadingBlankLines(text: string): string
```
### Object
Example:
```ts
function isObject(
val: unknown
): val is object & Record<string | symbol | number, unknown>
function isntObject<T>(
val: T
): val is Exclude<T, object & Record<string | symbol | number, unknown>>
removeLeadingBlankLines(
' ' + '\n'
+ 'a' + '\n'
+ ' '
)
// 'a' + '\n'
// + ' '
```
function isPlainObject(
val: unknown
): val is object & Record<string | symbol | number, unknown>
function isntPlainObject<T>(
val: T
): val is Exclude<T, object & Record<string | symbol | number, unknown>>
#### removeTrailingBlankLines
```ts
function removeTrailingBlankLines(text: string): string
```
function isEmptyObject(val: object): boolean
function isntEmptyObject(val: object): boolean
Example:
```ts
removeTrailingBlankLines(
' ' + '\n'
+ 'a' + '\n'
+ ' '
)
// ' ' + '\n'
// + 'a'
```
### JSON
### Enum
```ts
function isJson(val: unknown): Json
function isntJson<T>(val: T): val is Exclude<T, Json>
function inEnum<T>(val: unknown, _enum: object): val is T
function notInEnum<T, U>(val: T, _enum: object): val is Exclude<T, U>
```
function isJsonable<T extends Json>(val: unknown): val is Jsonable<T>
function isntJsonable<T>(val: T): val is Exclude<T, Jsonable<Json>>
### Date
```ts
function isDate(val: unknown): val is Date
function isntDate<T>(val: T): val is Exclude<T, Date>
```
### Function
```ts
function isFunction<T extends Function = (...args: any[]) => any>(
val: unknown
): val is T
function isntFunction<T>(val: T): val is Exclude<T, Function>
```
### RegExp

@@ -203,1 +204,72 @@ ```ts

```
### pipe
```ts
function pipe<A, B, C, D, E, F, G, H>(
value: A
, ...operators: [
(value: A) => B
, (value: B) => C
, (value: C) => D
, (value: D) => E
, (value: E) => F
, (value: F) => G
, (value: G) => H
]
): H
function pipe<A, B, C, D, E, F, G>(
value: A
, ...operators: [
(value: A) => B
, (value: B) => C
, (value: C) => D
, (value: D) => E
, (value: E) => F
, (value: F) => G
]
): G
function pipe<A, B, C, D, E, F>(
value: A
, ...operators: [
(value: A) => B
, (value: B) => C
, (value: C) => D
, (value: D) => E
, (value: E) => F
]
): F
function pipe<A, B, C, D, E>(
value: A
, ...operators: [
(value: A) => B
, (value: B) => C
, (value: C) => D
, (value: D) => E
]
): E
function pipe<A, B, C, D>(
value: A
, ...operators: [
(value: A) => B
, (value: B) => C
, (value: C) => D
]
): D
function pipe<A, B, C>(
value: A
, ...operators: [
(value: A) => B
, (value: B) => C
]
): C
function pipe<A, B>(
value: A
, ...operators: [
(value: A) => B
]
): B
function pipe<T, U>(
value: T
, ...operators: Array<(value: unknown) => unknown>
): U
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc