{"id":19460484,"url":"https://github.com/bjarneo/zero-pad","last_synced_at":"2025-10-16T20:37:40.144Z","repository":{"id":57405634,"uuid":"56255637","full_name":"bjarneo/zero-pad","owner":"bjarneo","description":"Should prepend a 0 to whole numbers \u003c= 9 and \u003e= 0. Perfect use case for dates.","archived":false,"fork":false,"pushed_at":"2018-02-20T09:32:56.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-08T15:17:00.443Z","etag":null,"topics":["date","dates","pad","padding"],"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/bjarneo.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":"2016-04-14T17:07:59.000Z","updated_at":"2020-11-22T21:32:56.000Z","dependencies_parsed_at":"2022-09-26T17:01:41.459Z","dependency_job_id":null,"html_url":"https://github.com/bjarneo/zero-pad","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjarneo%2Fzero-pad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjarneo%2Fzero-pad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjarneo%2Fzero-pad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjarneo%2Fzero-pad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bjarneo","download_url":"https://codeload.github.com/bjarneo/zero-pad/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240665162,"owners_count":19837686,"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":["date","dates","pad","padding"],"created_at":"2024-11-10T17:37:18.034Z","updated_at":"2025-10-16T20:37:35.112Z","avatar_url":"https://github.com/bjarneo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"zero-pad\n======\n![Travis](https://travis-ci.org/bjarneo/zero-pad.svg?branch=master)\n\nShould prepend a 0 to whole numbers less than equal 9 and larger than equal 0. Perfect use case for dates.\n\nInstallation\n------\n```bash\n$ npm i --save zero-pad\n```\n\nUsage\n------\n```js\nconst zeroPad = require('zero-pad');\n\nconsole.log(zeroPad(7)); // 07\nconsole.log(zeroPad(9)); // 09\nconsole.log(zeroPad(-1)); // -1\nconsole.log(zeroPad(0.1)); // 0.1\n\n// With an array as argument\nconst arr = zeroPad([1, 10, 7]);\nconsole.log(arr); // [01, 10, 07]\n\n// Example with dates\nconst date = new Date(2016, 10, 5);\nconst pad = zeroPad([\n  date.getFullYear(),\n  date.getMonth(),\n  date.getDate()\n]);\n\nconsole.log(pad.join('-')); // 2016-10-05\n```\n\nTests\n------\n```bash\n$ npm test\n```\n\nContribution\n------\nContributions are appreciated.\n\nLicense\n------\nMIT-licensed. See LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjarneo%2Fzero-pad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbjarneo%2Fzero-pad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjarneo%2Fzero-pad/lists"}