{"action":"created","issue":{"url":"https://api.github.com/repos/tc39/ecma262/issues/1292","repository_url":"https://api.github.com/repos/tc39/ecma262","labels_url":"https://api.github.com/repos/tc39/ecma262/issues/1292/labels{/name}","comments_url":"https://api.github.com/repos/tc39/ecma262/issues/1292/comments","events_url":"https://api.github.com/repos/tc39/ecma262/issues/1292/events","html_url":"https://github.com/tc39/ecma262/issues/1292","id":352597124,"node_id":"MDU6SXNzdWUzNTI1OTcxMjQ=","number":1292,"title":"String.prototype.padCenter, how about that?","user":{"login":"rzorzal","id":5184573,"node_id":"MDQ6VXNlcjUxODQ1NzM=","avatar_url":"https://avatars2.githubusercontent.com/u/5184573?v=4","gravatar_id":"","url":"https://api.github.com/users/rzorzal","html_url":"https://github.com/rzorzal","followers_url":"https://api.github.com/users/rzorzal/followers","following_url":"https://api.github.com/users/rzorzal/following{/other_user}","gists_url":"https://api.github.com/users/rzorzal/gists{/gist_id}","starred_url":"https://api.github.com/users/rzorzal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rzorzal/subscriptions","organizations_url":"https://api.github.com/users/rzorzal/orgs","repos_url":"https://api.github.com/users/rzorzal/repos","events_url":"https://api.github.com/users/rzorzal/events{/privacy}","received_events_url":"https://api.github.com/users/rzorzal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-08-21T15:32:35Z","updated_at":"2018-08-21T17:00:07Z","closed_at":"2018-08-21T15:38:06Z","author_association":"NONE","body":"Hello guys, I here to talk about padStart, padEnd and my new proposal \"padCenter\", I think it is not hard to develop because we already had padStart and padEnd.\r\n\r\nI thought that we need to add one more feature to String's prototype, and it is not a hard work. So the proposal is to create the String.prototype.padCenter that centralize a string with a max character lenght, equals we do when call the \"pad\" functions.\r\n\r\nFor exemple, when we call padStart\r\n\r\n```javascript\r\n\"MY-TEST\".padStart(32)\r\n//result: \"                         MY-TEST\"\r\n```\r\n\r\nand when we call padEnd:\r\n\r\n```javascript\r\n\"MY-TEST\".padEnd(32)\r\n//result: \"MY-TEST                         \"\r\n```\r\n\r\nhow about that:\r\n\r\n```javascript\r\n\"MY-TEST\".padCenter(32)\r\n//result: \"            MY-TEST            \"\r\n```\r\n\r\nI'm searching it for a long time and I seen people talking about it in different use cases. But for me it will be usefull when I need to send some text data to my bluetooth printer, becouse the length of his line is 32 and I need to centralize the data and adjust the line to right and left.\r\n\r\nI think this feature can improve the language and it will be useful for other developers like me.\r\n\r\nAlthough we has libs that has an implementation of it\r\nhttps://lodash.com/docs#pad\r\nhttp://gabceb.github.io/underscore.string.site/#pad\r\nhttps://vocajs.com/#pad\r\nI think it can be done for native functions too\r\n\r\nAnd it is native for other languages, such as:\r\n    1. PHP (https://www.w3schools.com/php/showphp.asp?filename=demo_func_string_str_pad3)\r\n    2. Python (https://docs.python.org/2/library/string.html#string.center)\r\n    3. Ruby (https://ruby-doc.org/core-2.2.0/String.html#center-method)\r\n    4. R (https://www.rdocumentation.org/packages/stringr/versions/1.3.1/topics/str_pad)\r\n    5. etc...\r\n\r\n\r\nWhat do you guys think ?\r\n\r\n( We can call it \"pad\" instead of \"padCenter\"  haha )\r\n"},"comment":{"url":"https://api.github.com/repos/tc39/ecma262/issues/comments/414746993","html_url":"https://github.com/tc39/ecma262/issues/1292#issuecomment-414746993","issue_url":"https://api.github.com/repos/tc39/ecma262/issues/1292","id":414746993,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDc0Njk5Mw==","user":{"login":"rzorzal","id":5184573,"node_id":"MDQ6VXNlcjUxODQ1NzM=","avatar_url":"https://avatars2.githubusercontent.com/u/5184573?v=4","gravatar_id":"","url":"https://api.github.com/users/rzorzal","html_url":"https://github.com/rzorzal","followers_url":"https://api.github.com/users/rzorzal/followers","following_url":"https://api.github.com/users/rzorzal/following{/other_user}","gists_url":"https://api.github.com/users/rzorzal/gists{/gist_id}","starred_url":"https://api.github.com/users/rzorzal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rzorzal/subscriptions","organizations_url":"https://api.github.com/users/rzorzal/orgs","repos_url":"https://api.github.com/users/rzorzal/repos","events_url":"https://api.github.com/users/rzorzal/events{/privacy}","received_events_url":"https://api.github.com/users/rzorzal/received_events","type":"User","site_admin":false},"created_at":"2018-08-21T17:00:07Z","updated_at":"2018-08-21T17:00:07Z","author_association":"NONE","body":"Thanks a lot, I will send the e-mail right now."}}
{"actor":{"display_login":"rzorzal"}}