{"id":28708346,"url":"https://github.com/bpierre/nodupes","last_synced_at":"2025-06-14T18:11:09.777Z","repository":{"id":65424804,"uuid":"14308164","full_name":"bpierre/nodupes","owner":"bpierre","description":"Prevent duplicate names by appending an incremented prefix.","archived":false,"fork":false,"pushed_at":"2019-02-13T17:26:46.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-13T10:56:11.365Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bpierre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-11T17:41:29.000Z","updated_at":"2023-03-08T04:15:50.000Z","dependencies_parsed_at":"2023-01-23T02:05:11.924Z","dependency_job_id":null,"html_url":"https://github.com/bpierre/nodupes","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bpierre/nodupes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpierre%2Fnodupes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpierre%2Fnodupes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpierre%2Fnodupes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpierre%2Fnodupes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bpierre","download_url":"https://codeload.github.com/bpierre/nodupes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpierre%2Fnodupes/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259860438,"owners_count":22922990,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-14T18:11:05.818Z","updated_at":"2025-06-14T18:11:09.759Z","avatar_url":"https://github.com/bpierre.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nodupes\n\nPrevent duplicate names by appending an incremented suffix.\n\n[![Build Status](https://travis-ci.org/bpierre/nodupes.png?branch=master)](https://travis-ci.org/bpierre/nodupes)\n\n\u003cimg src=\"http://scri.ch/kaa-2x.png\" width=\"603\" alt=\"\"\u003e\n\n## Examples\n\n### example/nodupes.js\n\n```javascript\nvar nodupes = require('nodupes')();\nvar names = ['name', 'name', 'othername', 'name', 'othername'];\nnames.forEach(function(name) {\n  console.log( nodupes(name) );\n});\n```\n\nOutput:\n\n```shell\n$ node example/nodupes.js\nname\nname-2\nothername\nname-3\nothername-2\n```\n\n## Usage\n\n```javascript\nvar nodupes = require('nodupes');\n```\n\n### var nd = nodupes(options)\n\nCall `nodupes()` to get a new nodupes function, with its own index and options.\n\nOptions:\n\n```javascript\nvar options = {\n  names: {},           // Load a pre-existing names index (see `nd.getNames()`).\n  suffixFirst: false,  // Add a suffix on the first appearance of a name.\n  separator: '-'       // Change the suffix separator.\n};\n```\n\n### nd('name')\n\nReturns the name with an appended suffix if needed.\n\n### nd.getNames()\n\nReturns the names index that you can pass to `nodupes()` with `options.names`.\n\n## Installation\n\n```shell\n$ npm install nodupes\n```\n\n## License\n\n[MIT](http://pierre.mit-license.org/)\n\n## Credits\n\nIllustration made by [Raphaël Bastide](http://raphaelbastide.com/) with [scri.ch](http://scri.ch/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpierre%2Fnodupes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbpierre%2Fnodupes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpierre%2Fnodupes/lists"}