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

brace-expansion

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brace-expansion

Brace expansion as known from sh/bash

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
127M
decreased by-15.11%
Maintainers
2
Weekly downloads
 
Created

What is brace-expansion?

The brace-expansion npm package is a library that allows users to generate an array of strings based on a pattern that includes braces. It is inspired by the brace expansion feature in shells like Bash and Zsh. This package can be used to expand expressions with braces to form combinations or sequences.

What are brace-expansion's main functionalities?

Generating combinations

This feature allows you to generate combinations from a pattern. The above code will output an array: ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'].

const braceExpansion = require('brace-expansion');
console.log(braceExpansion('file-{a,b,c}.jpg'));

Generating sequences

This feature generates sequences based on a numeric range. The above code will output an array: ['file-1.jpg', 'file-2.jpg', 'file-3.jpg'].

const braceExpansion = require('brace-expansion');
console.log(braceExpansion('file-{1..3}.jpg'));

Nested expansions

This feature supports nested braces for more complex patterns. The above code will output an array: ['file-a.jpg', 'file-b1.jpg', 'file-b2.jpg', 'file-c.jpg'].

const braceExpansion = require('brace-expansion');
console.log(braceExpansion('file-{a,b{1,2},c}.jpg'));

Other packages similar to brace-expansion

FAQs

Package last updated on 27 Feb 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