
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
string-patternizer
Advanced tools
Inspired by (but not copied from) format-string-by-pattern. Converts any string to match a given pattern. Currently supports letters (case-sensitive or -insensitive), digits, symbols, "any character" and specific/required characters.
yarn add string-patternizer
npm i string-patternizer
pnpm add string-patternizer
Returns a string based on source, formatted according to pattern.
Note that this is not a validation tool: it will only convert strings according to the pattern provided, but not otherwise check for their content. In other words, no function is provided to e.g. limit an IP address string to numbers smaller than 256.
pattern: string
Describes how the input should be formatted.
Characters with special meaning:
Any other character will be interpreted as "required", i.e. will automatically be copied as-is into the result string, even if not present in the source string. The special characters above need to be escaped to be used as "required".
source: string
The input value to be formatted.
import patternize from 'string-patternizer'
// US phone number (including country code)
patternize('5551234567', '\+1 (ddd) ddd dddd');
// '+1 (555) 123 4567'
// Full name
patternize('firstname lastname', 'Aa+ Aa+');
// 'Firstname Lastname'
// IP address (format only, no validation i.e. numbers over 255 are possible)
patternize('111222333444', 'ddd\.ddd\.ddd\.ddd');
// '111.222.333.444'
// Currency
patternize('1234', 'd+\.dd€');
// '12.34€'
FAQs
Convert strings to match a pattern
The npm package string-patternizer receives a total of 27 weekly downloads. As such, string-patternizer popularity was classified as not popular.
We found that string-patternizer 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.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.