
Security News
Frontier AI Is Now Critical Infrastructure
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.
@piadina/relabelr
Advanced tools
Smart label duplication and name conflict resolution with customizable copy formats.
Smart label duplication and name conflict resolution with customizable copy formats.
My Label → My Label Copy, My Label Copy (1), My Label (2), etc.
npm install @piadina/relabelr
# or
yarn add @piadina/relabelr
import { relabelr, incrementFileName, COPY_FORMATS } from '@piadina/relabelr';
// Basic usage
const uniqueLabel = relabelr('My Document', ['My Document', 'My Document copy']);
// Result: "My Document copy 2"
// With custom format
const uniqueLabel2 = relabelr('My Document', ['My Document'], COPY_FORMATS.PARENTHESES);
// Result: "My Document Copy (1)"
// Default: "copy", "copy 2", "copy 3"
COPY_FORMATS.DEFAULT
// Capitalized: "Copy", "Copy 2", "Copy 3"
COPY_FORMATS.CAPITALIZED
// Start with one: "copy 1", "copy 2", "copy 3"
COPY_FORMATS.START_WITH_ONE
// Parentheses: "Copy (1)", "Copy (2)", "Copy (3)"
COPY_FORMATS.PARENTHESES
// Numbers only: "(1)", "(2)", "(3)"
COPY_FORMATS.NUMBERS_ONLY
const customFormat: CopyFormat = {
copyWord: 'duplicate',
firstCopyFormat: '{copyWord}', // "duplicate"
numberedCopyFormat: '{copyWord}-{number}', // "duplicate-2", "duplicate-3"
};
incrementFileName('Document', customFormat);
// Result: "Document duplicate"
relabelr(proposedLabel, existingLabels, copyFormat?)Generates a unique label by checking against existing labels and appending copy suffixes as needed.
Parameters:
proposedLabel: string - The desired label nameexistingLabels: string[] - Array of existing labels to check againstcopyFormat?: CopyFormat - Optional copy format (defaults to COPY_FORMATS.DEFAULT)Returns: string - A unique label that doesn't conflict with existing labels
incrementFileName(name, copyFormat?)Increments a file name by adding or incrementing a copy suffix.
Parameters:
name: string - The file name to incrementcopyFormat?: CopyFormat - Optional copy format (defaults to COPY_FORMATS.DEFAULT)Returns: string - The incremented file name
import { incrementFileName, COPY_FORMATS } from '@piadina/relabelr';
// Default format
incrementFileName('document.pdf'); // "document copy.pdf"
incrementFileName('document copy.pdf'); // "document copy 2.pdf"
incrementFileName('document copy 5.pdf'); // "document copy 6.pdf"
// Parentheses format
incrementFileName('document.pdf', COPY_FORMATS.PARENTHESES); // "document Copy (1).pdf"
incrementFileName('document Copy (1).pdf', COPY_FORMATS.PARENTHESES); // "document Copy (2).pdf"
import { relabelr, COPY_FORMATS } from '@piadina/relabelr';
const existingLabels = ['Report', 'Report copy', 'Report copy 3'];
// Find next available name
relabelr('Report', existingLabels);
// Result: "Report copy 2" (fills the gap)
// Use different format
relabelr('Report', ['Report'], COPY_FORMATS.PARENTHESES);
// Result: "Report Copy (1)"
FAQs
Smart label duplication and name conflict resolution with customizable copy formats.
We found that @piadina/relabelr 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
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.