Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@bitty/falsy
Advanced tools
Readme
@bitty/falsy
Falsy helper functions and types for TypeScript.
📦 Distributions in ESM, CommonJS, UMD and UMD minified formats.
⚡ Lightweight:
🔋 Bateries included:
🏷 Safe:
This library is published in the NPM registry and can be installed using any compatible package manager.
npm install @bitty/falsy --save
# For Yarn, use the command below.
yarn add @bitty/falsy
This module has a UMD bundle available through JSDelivr and Unpkg CDNs.
<!-- For UNPKG use the code below. -->
<script src="https://unpkg.com/@bitty/falsy"></script>
<!-- For JSDelivr use the code below. -->
<script src="https://cdn.jsdelivr.net/npm/@bitty/falsy"></script>
<script>
// UMD module is exposed through the "isFalsy" global function.
console.log(isFalsy);
//=> "[Function: isFalsy]"
console.log(isFalsy(null));
//=> true
</script>
This module default exports isFalsy
, which is a predicate function that checks if value is falsy.
import isFalsy from '@bitty/pipe';
isFalsy();
isFalsy(null);
isFalsy(undefined);
isFalsy(0);
isFalsy(-0);
isFalsy(0n);
isFalsy(NaN);
isFalsy('');
isFalsy(false);
//=> true
isFalsy('Not empty.');
//=> false
We also exports NonFalsy
and Falsy
types.
Falsy
is simply an union of false
, void
, ''
, 0
, 0n
, null
and undefined
, types.
import { Falsy } from '@bitty/falsy';
let falsy: Falsy;
falsy = false;
falsy = undefined as void;
falsy = '';
falsy = 0;
falsy = 0n;
falsy = null;
falsy = undefined;
falsy = 1;
//=> throws "Type '1' is not assignable to type 'Falsy'.".
NonFalsy<T>
is a type helper that removes falsy types.
import { NonFalsy } from '@bitty/falsy';
type Value = 0 | 1 | 2;
const value: NonFalsy<Value> = 0;
//=> throws "Type '0' is not assignable to type '1 | 2'.".
Released under MIT License.
FAQs
Falsy helper functions and types for TypeScript.
The npm package @bitty/falsy receives a total of 10 weekly downloads. As such, @bitty/falsy popularity was classified as not popular.
We found that @bitty/falsy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.