{"id":19097284,"url":"https://github.com/atmajs/atma-formatter","last_synced_at":"2026-04-08T19:31:15.525Z","repository":{"id":13523636,"uuid":"16214855","full_name":"atmajs/atma-formatter","owner":"atmajs","description":"Localizable number. string and date formatter","archived":false,"fork":false,"pushed_at":"2017-03-24T10:33:20.000Z","size":66,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-01T07:13:51.415Z","etag":null,"topics":["date-formatter","localization","number-formatter","pluralization","string-formatter"],"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/atmajs.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-01-24T19:42:11.000Z","updated_at":"2022-06-27T05:58:23.000Z","dependencies_parsed_at":"2022-08-31T00:12:13.995Z","dependency_job_id":null,"html_url":"https://github.com/atmajs/atma-formatter","commit_stats":null,"previous_names":["atmajs/util-format"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/atmajs/atma-formatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atmajs%2Fatma-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atmajs%2Fatma-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atmajs%2Fatma-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atmajs%2Fatma-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atmajs","download_url":"https://codeload.github.com/atmajs/atma-formatter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atmajs%2Fatma-formatter/sbom","scorecard":{"id":214861,"data":{"date":"2025-08-11","repo":{"name":"github.com/atmajs/atma-formatter","commit":"8b41c397641786318cd9d55e17b4a8dfd7eaa472"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T01:27:58.819Z","repository_id":13523636,"created_at":"2025-08-17T01:27:58.819Z","updated_at":"2025-08-17T01:27:58.819Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31571599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["date-formatter","localization","number-formatter","pluralization","string-formatter"],"created_at":"2024-11-09T03:39:47.730Z","updated_at":"2026-04-08T19:31:15.506Z","avatar_url":"https://github.com/atmajs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### Formatter Library (_NodeJS and Browser_)\n\n----\n[![Build Status](https://travis-ci.org/atmajs/atma-formatter.png?branch=master)](https://travis-ci.org/atmajs/atma-formatter)\n[![NPM version](https://badge.fury.io/js/atma-formatter.svg)](http://badge.fury.io/js/atma-formatter)\n[![Bower version](https://badge.fury.io/bo/atma-formatter.svg)](http://badge.fury.io/bo/atma-formatter)\n\n\nFeatures:\n\n- [Date Formatter](#date-formatter)\n- [Number Formatter](#number-formatter)\n- [String Formatter](#string-formatter) (_format, align, pluralize_)\n- [Static Methods](#static-methods)\n- [Languages and Cultures](#internationalization)\n- MaskJS util support\n\n#### Usage\n###### NodeJS\n```javascript\nvar Formatter = require('atma-formatter');\n```\n###### Browser\n- [examples](examples)\n```javascript\nwindow.Formatter\n```\n\n### Date Formatter\n\nPlaceholder | Description\n--- | ---\n`yyyy` | Full **Year** Number\n`yy` | Short **Year** Number\n`MM` | **Month** Number in 2 digits, e.g. '03'\n`#M` | **Month** Number in one or 2 digits\n`Mm` | Short **Month** Name, e.g. 'Jan', 'Feb'\n`MMM` | Full **Month** Name, e.g. 'January'\n`dd` | **Date** Number in 2 digits\n`#d` | **Date** Number in one or 2 digits\n`Dd` | Short **Day** Name, e.g. 'Mo', 'Tu'\n`DD` | Full **Day** Name, e.g. 'Monday'\n`HH` | **Hours** Number in 2 digits, e.g. '03'\n`#H` | **Hours** Number in one or 2 digits\n`hh` | alias for 'HH'\n`#h` | alias for '#H'\n`mm` | **Minutes** in 2 digits\n`#m` | **Minutes** in on or 2 digits\n`ss` | **Seconds** in 2 digits\n`#s` | **Seconds** in on or 2 digits\n\nStandalone NodeJS example:\n```javascript\nvar format = require('atma-formatter');\nvar str = format(new Date, \"#d MMM, yyyy (hh:mm)\");\n//\u003e  1 January, 2014 (09:55)\n```\n\nMask example:\n_mask_\n```mask\ndiv \u003e 'Today - ~[format: today, \"#d MMM, yyyy (hh:mm)\"]'\n```\n_javascript model_\n```javascript\n{ today: new Date }\n```\n\n_Output_\n```html\n\u003cdiv\u003eToday - 1 January, 2014 (09:55)\u003c/div\u003e\n```\n\nJavascript example:\n```javascript\nvar str = mask._.format(new Date, \"#d MMM, yyyy (hh:mm)\");\n//\u003e  1 January, 2014 (09:55)\n```\n\n### Number Formatter\n\nPattern: e.g. `,0.0`\n\nPlaceholder | Description\n--- | ---\n`,` | (optional) First char setts the integral part delimiter. Comma is used for default, which is defined by the current culture info.\n`0` | Then goes the integral part of the number. More Zeros can be specified for the minimal digit output\n`.` | (optional) Floating point. If omitted then the number is rounded to integer. When no zeros follow the point, faction will be printed as is.\n`0` | (optional) Fraction. When defined, the fraction part of the number is rounded to the specified zeros count. When zeros in pattern are taken in parenthese, then trailing zeros will be removed from result.\n\nSamples:\n\nValue | Formatter | Result\n--- | --- | ---\n`1234.123` | `,00000.0` | `01,234.1`\n`1234.123` | `0` | `1234`\n`1.5` | `00.00` | `01.50`\n`3.145` | `00.` | `03.145`\n`3.4` | `0.(000)` | `3.4`\n`3.4566` | `0.(000)` | `3.457`\n\n\nStandalone NodeJS example:\n```javascript\nvar format = require('atma-formatter');\nvar str = format(4500.3851, \",0.00\");\n//\u003e  4,500.39\n```\n\n_Mask example_\n```css\ndiv \u003e 'Sum - ~[format: sum, \",0.00\"]'\n```\n\n_Javascript model_\n```javascript\n{ sum: 4500.3851 }\n```\n\n_Output_\n```html\n\u003cdiv\u003eSum - 4,500.39\u003c/div\u003e\n```\n\n_Javascript example_\n```javascript\nvar str = mask._.format(4500.3851, \",0.00\");\n//\u003e  4,500.39\n```\n\n### String Formatter\n#### `{ accessor[,alignment][:pattern][;switch] }`\n\n- `accessor`: index or dot-notated property\n\t\n\t```javascript\n\t/* index */\n\tformat('Hello {0} - {1} {0}', 'World', 'my')\n\t//\u003e 'Hello World, my World'\n\t\n\t/* property */\n\tformat('Hello {name} - {stats.qux}', {\n\t\tname: 'Bar',\n\t\tstats: {\n\t\t\tqux: 20\n\t\t}\n\t});\n\t//\u003e 'Hello Bar - 20'\n\t```\n- `alignment`: minimum chars count with right/left alignment\n\n\t```javascript\n\tformat('x{0,10}x', 'Q');\n\t//\u003e 'x         Qx'\n\tformat('x{0,-10}x', 'Q');\n\t//\u003e 'xQ         x'\n\t\n\t```\n\t\n- `pattern`: `Date` `Number` format patterns. Refer to [Date Formatter](#date-formatter) and [Number Formatter](#number-formatter)\n\t\n\t```javascript\n\tformat('Year: {date:yyyy}', { date: new Date(2015, 0, 1)});\n\t//\u003e Year: 2015\n\t```\n- `switch/pluralization`: `pattern:string;otherPattern:string; ...` Choose interpolated string according to arguments value. Each string can contain nested interpolations.\n\t_[i18n](https://github.com/atmajs/i18n) benefits of this feature_\n\t\n\t- Number patterns:\n\t\t- Strict and Ending patterns: `12`, `*12`\n\t\t- Ranges: `12-16`, `*12-16`\n\t\t- Groups: `0,1,2`\n\t\t- Any: `*`\n\t\t\n\t```javascript\n\tformat('{num; 0:Foo; 1,2:Baz {name}}', {\n\t\tnum: 2,\n\t\tname: 'Qux'\n\t})\n\t//\u003e 'Baz Qux'\n\t\n\t// i18n, e.g. russian has 3 plural forms. 'N day(s)' sample\n\tformat('{days} {days; *0,*11-14,*5-9: дней; *1: день; *2-4:дня }', {\n\t\tdays: 21\n\t})\n\t//\u003e '21 день'\n\t\n\t// It is also possible to move pluralization pattern to the cultureInfo.\n\t// then it would be\n\tformat('{days} {days; день, дня, дней }', {\n\t\tdays: 21\n\t})\n\t//\u003e '21 день'\n\t```\n\n\nStandalone NodeJS example:\n```javascript\nvar format = require('atma-formatter');\nvar str = format(\n\t\"Name: {0}; Born: {1:dd MMM yyyy}; Salary: ${2:,0.00}\",\n\t'John',\n\tnew Date(1975, 0, 1),\n\t17000\n);\n//\u003e  Name: John; Born: 01 January 1975; Salary: $17,000.00\n```\n\n\n_Mask example_\n```css\ndiv \u003e '~[format: \"Name: {0}; Born: {1:dd MMM yyyy}; Salary: ${2:,0.00}\", user.name, user.birth, user.salary]'\n```\n\n_Javascript model_\n```javascript\n{ user: { name: 'John', birth: new Date(1975, 0, 1), salary: 17000 } }\n```\n\n_Output_\n```html\n\u003cdiv\u003eName: John; Born: 01 January 1975; Salary: $17,000.00\u003c/div\u003e\n```\n\n_Javascript example_\n```javascript\nvar str = mask._.format(\"{0:,000}\", 5.35);\n//\u003e  005\n```\n\n### Static methods\n\nThe `format` method takes the formatter by the input value. You can use  formatters directly. Formatters will also try to convert the input value to the desired type. For instance, when a `string` is passed to `formatDate` then we try to convert it to the `Date` instance.\n\n```javascript\nvar Formatter = require('atma-formatter');\nFormatter.formatNumber(value, pattern, cultureInfo?);\nFormatter.formatString(value, pattern, cultureInfo?);\nFormatter.formatDate(value, pattern, cultureInfo?);\n```\n\n### Internationalization\nThere are already `EN` and `DE` support.\n\nAdd culture support sample:\n```javascript\nvar formatter = require('atma-formatter');\nformatter.Lang.$register('ru', {\n\tMONTH: ['Январь',...],\n\tMONTH_SHORT: ['Ян.',...],\n\tDAY: ['Воскресенье',...],\n\tDAY_SHORT: ['Bc',...],\n\n\tNUMBER: {\n\t\t// 1 000 000,00\n\t\tDelimiter: ' ',\n\t\tPoint: ',',\n\t\tDefault: string|number\n\t\t// When number, then for NaN input the default value will be formatted\n\t\t// When string, then it will be returned on NaN input\n\t}\n});\nformatter.Lang.$use('ru');\n```\n\n#### Build, Test\n- Build\n\n\t```bash\n\t$ npm install atma -g\n\t$ atma\n\t```\n\n- Test\n\n\t```bash\n\t$ atma test\n\t```\n\n----\n(c) MIT - Atma.js Project","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatmajs%2Fatma-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatmajs%2Fatma-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatmajs%2Fatma-formatter/lists"}