Socket
Socket
Sign inDemoInstall

compatx

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compatx

🌴 Gradual feature flags.


Version published
Weekly downloads
372K
decreased by-15.45%
Maintainers
1
Weekly downloads
 
Created
Source

compatx

npm version npm downloads

🌴 Compatibility toolkit.

[!NOTE] This is a WIP toolkit. See RFC for initial motivations.

Install

# ✨ Auto-detect
npx nypm install -D compatx

# npm
npm install -D compatx

# yarn
yarn add -D compatx

# pnpm
pnpm install -D compatx

# bun
bun install -D compatx

Utils

formatCompatibilityDate(input)

Format compatibility date spec to a string

formatDate(date)

Format a date to a YYYY-MM-DD string

Example:

formatDateString(new Date("2021/01/01")) // "2021-01-01"

getCompatibilityChanges(allUpdates, compatibilityDate1, compatibilityDate2)

Get compatibility changes between two dates.

getCompatibilityUpdates(allUpdates, compatibilityDate)

Get compatibility updates applicable for the user given platform and date range.

platforms

  • Type: array
  • Default: ["aws","azure","cloudflare","deno","firebase","netlify","vercel"]

resolveCompatibilityDates(input?, defaults?)

Normalize the compatibility dates from input config and defaults.

resolveCompatibilityDatesFromEnv(overridesInput?)

Resolve compatibility dates with environment variables as defaults.

Environment variable name format is COMPATIBILITY_DATE for default and COMPATIBILITY_DATE_<PLATFORM> for specific platforms.

Types

import type {
  // Typed date string in `YYYY-MM-DD` format
  DateString,
  // Platform names
  PlatformName,
  // Compatibility dates
  CompatibilityDateSpec,
  CompatibilityDates,
  // Compatibility updates
  CompatibilityUpdate,
  CompatibilityUpdates
} from "./types";

Development

  • Clone this repository
  • Install latest LTS version of Node.js
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

License

Made with 💛

Published under MIT License.

FAQs

Package last updated on 12 Jun 2024

Did you know?

Socket

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.

Install

Related posts

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