
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
"
Pickline &replace"A simple, zero dependency, recursive, text replacer.
Use to update a specific text across multiple file types in a project.
Finds matching lines in files, based on text or regular expression, and runs a text replacement on just those lines matched*.
* If you have special cases, you can supply a filter function to exclude those special cases.
You might be reading this because you're in a pickle where you have to change a line or text pattern across a big project. No worries, picklr allows you to test replacement behavior prior to any updates with actions echo and audit. It's good to see what would happen prior to any file being updated across a project, and also what files will get omitted from the change set.
Picklr exports a single function that starts synchronous file processing when invoked.
function (startDir, options)
A brief description of the options that control file selection and processing:
echo|audit|update The action taken on each file. Defaults to echo. Use echo and audit actions to test the results of picklr with options prior to running update.
includeExts and excludeDirsRe options.targetText and replacementText. Outputs lines found and the change plus any files that would be omitted. Tests includeExts, excludeDirsRe, targetText and replacementText options.string.replace.targetText. Second argument to string.replace.targetText. Return true to allow the replacement to proceed as normal, false to deny it. If not supplied, defaults to all matched replacements allowed.console.log.// Example use for a copyright banner text update:
import picklr from 'picklr';
// Output what files WOULD be affected by includes/excludes:
picklr('.', {
action: 'echo',
includeExts: ['.js', '.jsx', '.scss'],
excludeDirsRe: /\/\.|node_modules|dist|tmp|reports/i
});
// Output what WOULD be processed using targetText/replacementText:
picklr('.', {
action: 'audit',
targetText: 'Copyright (c) 2015',
replacementText: 'Copyright (c) 2015, 2016',
includeExts: ['.js', '.jsx', '.scss'],
excludeDirsRe: /\/\.|node_modules|dist|tmp|reports/i
});
// Got it. Now, actually perform the pick line and replacement.
picklr('.', {
action: 'update',
targetText: 'Copyright (c) 2015',
replacementText: 'Copyright (c) 2015, 2016',
includeExts: ['.js', '.jsx', '.scss'],
excludeDirsRe: /\/\.|node_modules|dist|tmp|reports/i
});
// import the es module in a non-module environment, echo options example:
import('picklr').then(({ picklr }) => {
picklr('.', {
action: 'echo',
includeExts: ['.js', '.jsx', '.scss'],
excludeDirsRe: /\/\.|node_modules|dist|tmp|reports/i
});
});
To see only what files would be omitted, set your picklr script to use action 'audit', then grep the output for 'Omitted'.
// myPicklrScript.js
import picklr from 'picklr';
picklr('.', {
action: 'audit',
targetText: 'Copyright (c) 2015',
replacementText: 'Copyright (c) 2015, 2016',
includeExts: ['.js', '.jsx', '.scss'],
excludeDirsRe: /\/\.|node_modules|dist|tmp|reports/i
});
node myPicklrScript.js | grep 'Omitted'
MIT
FAQs
A utility to update a single line in multiple files
We found that picklr demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.