{"id":21541598,"url":"https://github.com/omergulcicek/money-format","last_synced_at":"2025-03-17T22:53:19.605Z","repository":{"id":124254371,"uuid":"141441002","full_name":"omergulcicek/money-format","owner":"omergulcicek","description":"Parametre olarak aldığı değeri para formatına çevirir","archived":false,"fork":false,"pushed_at":"2021-04-25T10:07:26.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-24T08:31:02.056Z","etag":null,"topics":["dolar","euro","money","money-format","para","para-format","pound"],"latest_commit_sha":null,"homepage":null,"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/omergulcicek.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-18T13:47:40.000Z","updated_at":"2024-02-05T20:13:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea65a136-0d42-4976-b717-aeacff5e0156","html_url":"https://github.com/omergulcicek/money-format","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/omergulcicek%2Fmoney-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omergulcicek%2Fmoney-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omergulcicek%2Fmoney-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omergulcicek%2Fmoney-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omergulcicek","download_url":"https://codeload.github.com/omergulcicek/money-format/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244123501,"owners_count":20401599,"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":["dolar","euro","money","money-format","para","para-format","pound"],"created_at":"2024-11-24T05:07:00.452Z","updated_at":"2025-03-17T22:53:19.598Z","avatar_url":"https://github.com/omergulcicek.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Money Format\n\nParametre olarak aldığı değeri para formatına çevirir.\n\n## Kullanımı\n\nTam sayı yada noktalı değeri parametre olarak alıp, TR para formatında çıktı verir.\n\nParametre integer yada string olarak gelebilir. Küsüratlı değerleri noktalı şekilde gönderin.\n\nVirgülden sonraki 2 basamağı gösterir; küsürata göre değeri üste yuvarlayabilir.\n\n```js\nmoneyFormat(100000)     =\u003e \"100.000\"\n\nmoneyFormat(123456789)  =\u003e \"123.456.789\"\n\nmoneyFormat(123.456)    =\u003e \"123,46\"\n\nmoneyFormat(123456.789) =\u003e \"123.456,79\"\n```\n\n## Kaynak Kod Açıklaması\n\n```js\nfunction moneyFormat(n) {\n  //Parametre aldığı para değerini 1.000.000,50 formatına çevirir\n  //Genel kontroller\n  if (n == null || n === \"\" || typeof n == \"object\") { return \"\" }\n  else if (typeof n == \"number\") { n = n.toString() }\n\n  //Değişken tanımlamaları\n  var a, x, reverseTemp = \"\", reverse = \"\";\n\n  //Her 3 rakamdan sonra nokta koyup, parametre küsüratlı değil ise sonuna .00 ekler. (123456 =\u003e 123.456.00 yada 12345,67 =\u003e 12.345.67)\n  a = parseFloat(n.replace(\",\", \".\")).toFixed(2).replace(/(\\d)(?=(\\d{3})+\\.)/g, '$1.');\n\n  //x değişkeni sondaki küsüratı alır. (123.456.78 =\u003e x = ,78)\n  x = a.substr(a.length - 3).replace(\".\", \",\");\n\n  //Rakamı ters şekilde temp değişkenine atar. (123.456.00 =\u003e 00.654.321)\n  for (i = a.length - 1; i \u003e= 0; i--) { reverseTemp += a[i]; }\n\n  //İlk noktayı virgül yapar. (00.654.321 =\u003e 00,654.321)\n  reverseTemp = reverseTemp.replace(\".\", \",\");\n\n  //Rakamı tekrardan terse çevirerek, son haline getirir. (00,654.321 =\u003e 123.456,00)\n  for (i = reverseTemp.length - 1; i \u003e= 0; i--) { reverse += reverseTemp[i]; }\n\n  //Eğer küsürat ,00 ise kaldırır\n  if (x == \",00\") {\n      reverse = reverse.slice(0, a.length-3)\n  }\n  return reverse;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomergulcicek%2Fmoney-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomergulcicek%2Fmoney-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomergulcicek%2Fmoney-format/lists"}