{"id":16642035,"url":"https://github.com/artskydj/leading-chars","last_synced_at":"2025-07-30T01:35:12.468Z","repository":{"id":143885415,"uuid":"20774955","full_name":"ArtskydJ/leading-chars","owner":"ArtskydJ","description":":arrow_backward: Creates leading characters for a string or number (left-pad, haha)","archived":false,"fork":false,"pushed_at":"2016-01-02T17:10:58.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-22T18:53:04.266Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ArtskydJ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-12T16:35:29.000Z","updated_at":"2016-10-05T19:09:59.000Z","dependencies_parsed_at":"2023-05-04T09:02:28.155Z","dependency_job_id":null,"html_url":"https://github.com/ArtskydJ/leading-chars","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ArtskydJ/leading-chars","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtskydJ%2Fleading-chars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtskydJ%2Fleading-chars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtskydJ%2Fleading-chars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtskydJ%2Fleading-chars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArtskydJ","download_url":"https://codeload.github.com/ArtskydJ/leading-chars/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArtskydJ%2Fleading-chars/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267792850,"owners_count":24144932,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2024-10-12T07:48:41.680Z","updated_at":"2025-07-30T01:35:12.440Z","avatar_url":"https://github.com/ArtskydJ.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"leading-chars\r\n=============\r\n\r\n\u003e Creates leading or trailing characters in a string or number\r\n\r\n[![Build Status](https://travis-ci.org/ArtskydJ/leading-chars.svg?branch=master)](https://travis-ci.org/ArtskydJ/leading-chars)\r\n\r\n# examples\r\n\r\nLeading Zeroes:\r\n\r\n```js\r\nvar leadingZeroes = LeadingChars({\r\n\tlen: 8,\r\n\toverall: true,\r\n\tcharacter: '0',\r\n\tleading: true\r\n})\r\n\r\nleadingZeroes('5f39a6') //returns '005f39a6'\r\nleadingZeroes('')       //returns '00000000'\r\nleadingZeroes('ftw')    //returns '00000ftw'\r\n```\r\n\r\nIndent with one tab:\r\n\r\n```js\r\nvar indent = LeadingChars({\r\n\tlen: 1,\r\n\toverall: false,\r\n\tcharacter: '\\t',\r\n\tleading: true\r\n})\r\n\r\nindent('Hey what is up')  //returns '\\tHey what is up'\r\nindent()                  //returns '\\t'\r\nindent('blah', {len: 2})  //returns '\\t\\tblah'\r\n```\r\n\r\nAppend full stops: (Sometimes referred to as 'periods')\r\n\r\n```js\r\nvar addFullStop = LeadingChars({\r\n\tlen: 1,\r\n\toverall: false,\r\n\tcharacter: '.',\r\n\tleading: false\r\n})\r\n\r\naddFullStop('Hey what is up') //returns 'Hey what is up.'\r\naddFullStop(null)             //returns '.'\r\naddFullStop('blah', {len: 3}) //returns 'blah...'\r\n```\r\n\r\nFill with J's:\r\n\r\n```js\r\nvar fillWithJs = LeadingChars({\r\n\tlen: 4,\r\n\toverall: true,\r\n\tcharacter: 'J',\r\n\tleading: true\r\n})\r\n\r\nfillWithJs('a')     //returns 'JJJa'\r\nfillWithJs('aaa')   //returns 'Jaaa'\r\nfillWithJs('aaaaa') //returns 'aaaaa'\r\n```\r\n\r\nPrefix 2 E's:\r\n\r\n```js\r\nvar prefixTwoEs = LeadingChars({\r\n\tlen: 2,\r\n\toverall: false,\r\n\tcharacter: 'E',\r\n\tleading: true\r\n})\r\n\r\nprefixTwoEs('a')     //returns 'EEa'  \r\nprefixTwoEs('aaa')   //returns 'EEaaa'  \r\nprefixTwoEs('aaaaa') //returns 'EEaaaaa'\r\n```\r\n\r\nLeading Smileys:\r\n\r\n```js\r\nvar leadingSmileys = LeadingChars({\r\n\tlen: 2,\r\n\toverall: false,\r\n\tcharacter: ':) ',\r\n\tleading: true\r\n})\r\n\r\nleadingSmileys('lol')  //returns ':) :) lol'  \r\nleadingSmileys('wat')  //returns ':) :) wat'  \r\nleadingSmileys('uber') //returns ':) :) uber'\r\n```\r\n\r\nTrailing Frowneys:\r\n\r\n```js\r\nvar trailingFrowneys = LeadingChars({\r\n\tlen: 1,\r\n\toverall: false,\r\n\tcharacter: ' :(',\r\n\tleading: true\r\n})\r\n\r\ntrailingFrowneys('no')     //returns 'no :('  \r\ntrailingFrowneys('so sad') //returns 'so sad :('  \r\ntrailingFrowneys('um why') //returns 'um why :('\r\n```\r\n# api\r\n\r\n```js\r\nvar LeadingChars = require('leading-chars')\r\n```\r\n\r\n# `LeadingChars(options)`\r\n\r\nLeadingChars is a constructor function that takes options and exports the user function.\r\n\r\nIf you don't understand these notes, check out the [examples](#examples), they should make it more clear.\r\n\r\n- `options` is an object with the following properties:\r\n\t- `len` is a number for how many characters to fill or concatenate (depending on `overall`).\r\n\t- `overall` is a boolean. It specifies whether the `character` is filled up to `len`, (`true`), or if the `character` is concatenated `len` times, (`false`).\r\n\t- `character` is the character that is added to the string or number.\r\n\t- `leading` is a boolean of whether `character` should be added to the beginning or the end. If you want the concatenated characters to lead the string or number, set this to `true`. If you want them characters to trail, set this to `false`.\r\n- Returns: [`constructed(input, options)`](#constructedinput-options)\r\n\r\n# constructed(input, options)\r\n\r\n- `input` is the string or number that is appended to.\r\n\r\n- `options` are the same as `LeadingChars()`s [options](#options), and they take precedence.\r\n\r\n# install\r\n\r\nInstall with [NPM](https://nodejs.org/download)\r\n\r\n\tnpm install leading-chars\r\n\t\r\n\r\n# license\r\n\r\n[VOL](http://veryopenlicense.com)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartskydj%2Fleading-chars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartskydj%2Fleading-chars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartskydj%2Fleading-chars/lists"}