
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
A barebones but feature-rich string formatter
$ npm install fmat
Import fmat into your project.
import fmat from 'fmat';
Use it by calling the function with an input value and options, this will always return a string.
const formattedString = fmat('hello', {}); // -> 'hello'
delimiter: stringSet the delimiter to insert at every format value index within the input string.
Default: " "
Usage
const formattedString = fmat('hello', { format: [1], delimiter: '!' }); // -> 'h!ello'
execution: 'loop' | 'hang' | 'exec'Set the behaviour when the string is longer than the available format indexes.
loop - loops the format until the end of the input string.hang - loops the last format value until the end of the input string.exec - runs just the format and quits after.Default: 'exec'
Usage
const formattedString = fmat('hello', { format: [1], execution: 'loop' }); // -> 'h e l l o'
const formattedString = fmat('hello', { format: [2, 1], execution: 'hang' }); // -> 'he l l o'
const formattedString = fmat('hello', { format: [2, 1], execution: 'exec' }); // -> 'he l lo'
format: Array<number | { step: number, delimiter: string}>Set the steps which represent indexes to add a delimiter to. You can specify an array of just a number or an object with the step value and a delimiter for that specific step. These options can be mixed together.
Default: []
Usage
const formattedString = fmat('hello', { format: [1] }); // -> 'h ello'
const formattedString = fmat('hello', { format: [1, { step: 2, delimiter: '-' }] }); // -> 'h el-lo'
prefix: stringSet a prefix for your input to be included in formatting.
Default: ""
Usage
const formattedString = fmat('1234567890', { format: [4, 2], execution: 'hang', prefix: "+316" }); // -> '+316 12 34 56 78 90'
Want to contribute? Great! Please branch out from the master version from using a branchname such as feature/{insert-descriptive-feature-name} and create a pull request when ready.
Use npm run build to build the project.
FAQs
A barebones yet feature-rich string formatter.
The npm package fmat receives a total of 40 weekly downloads. As such, fmat popularity was classified as not popular.
We found that fmat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.