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

just-compact

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

just-compact - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

11

index.d.ts
// NaN and document.all are also falsy but they cannot be represented as a type
type Falsy = false | null | undefined | '' | 0 | 0n;
// return type has
export default function compact<T>(arr: (Falsy | T)[]): T[];
/**
* Removes all falsy values from an array
* @example
* compact([1, null, 2, undefined, NaN, 3, 4, false, 5]);
* // => [1, 2, 3, 4, 5]
* compact([1, 2, [], 4, {}]);
* // => [1, 2, [], 4, {}]
*/
export default function compact<T>(arr: (Falsy | T)[]): T[];

2

index.tests.ts

@@ -22,2 +22,2 @@ import compact from './index';

// @ts-expect-error
compact({ a: true, b: false })
compact({ a: true, b: false })
{
"name": "just-compact",
"version": "2.2.0",
"version": "2.3.0",
"description": "returns a copy of an array with falsey values removed",

@@ -5,0 +5,0 @@ "main": "index.js",

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