{"id":18327212,"url":"https://github.com/dalikewara/vcmcemtex","last_synced_at":"2025-04-09T16:29:58.348Z","repository":{"id":57391128,"uuid":"170005132","full_name":"dalikewara/vcmcemtex","owner":"dalikewara","description":"Universal \u0026 customable cemtex generator for batch transactions","archived":false,"fork":false,"pushed_at":"2022-08-29T17:58:09.000Z","size":18,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T02:06:20.096Z","etag":null,"topics":["banks","cemtex","helper","javascript","tool","toolkit","vascomm"],"latest_commit_sha":null,"homepage":"","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/dalikewara.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"dalikewara","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2019-02-10T17:29:35.000Z","updated_at":"2022-02-17T14:34:47.000Z","dependencies_parsed_at":"2022-09-19T05:00:26.278Z","dependency_job_id":null,"html_url":"https://github.com/dalikewara/vcmcemtex","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/dalikewara%2Fvcmcemtex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalikewara%2Fvcmcemtex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalikewara%2Fvcmcemtex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalikewara%2Fvcmcemtex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dalikewara","download_url":"https://codeload.github.com/dalikewara/vcmcemtex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248067563,"owners_count":21042317,"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":["banks","cemtex","helper","javascript","tool","toolkit","vascomm"],"created_at":"2024-11-05T19:09:57.910Z","updated_at":"2025-04-09T16:29:58.329Z","avatar_url":"https://github.com/dalikewara.png","language":"JavaScript","funding_links":["https://github.com/sponsors/dalikewara"],"categories":[],"sub_categories":[],"readme":"[![npm package](https://nodei.co/npm/vcmcemtex.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/vcmcemtex/)\n\n[![version](https://img.shields.io/npm/v/vcmcemtex.svg?style=flat)](https://img.shields.io/npm/v/vcmcemtex.svg?style=flat)\n[![build](https://img.shields.io/circleci/project/github/dalikewara/vcmcemtex.svg?style=flat)](https://img.shields.io/circleci/project/github/dalikewara/vcmcemtex.svg?style=flat)\n[![language](https://img.shields.io/github/languages/top/dalikewara/vcmcemtex.svg?style=flat)](https://img.shields.io/github/languages/top/dalikewara/vcmcemtex.svg?style=flat)\n[![download](https://img.shields.io/npm/dt/vcmcemtex.svg?style=flat)](https://img.shields.io/npm/dt/vcmcemtex.svg?style=flat)\n[![dependents](https://img.shields.io/librariesio/dependents/npm/vcmcemtex.svg?style=flat)](https://img.shields.io/librariesio/dependents/npm/vcmcemtex.svg?style=flat)\n[![issue](https://img.shields.io/github/issues/dalikewara/vcmcemtex.svg?style=flat)](https://img.shields.io/github/issues/dalikewara/vcmcemtex.svg?style=flat)\n[![last_commit](https://img.shields.io/github/last-commit/dalikewara/vcmcemtex.svg?style=flat)](https://img.shields.io/github/last-commit/dalikewara/vcmcemtex.svg?style=flat)\n[![license](https://img.shields.io/npm/l/vcmcemtex.svg?style=flat)](https://img.shields.io/npm/l/vcmcemtex.svg?style=flat)\n\n# An universal \u0026 customable cemtext generator for batch transactions\n`Cemtext` file format is a format used by banks to allow for batch transactions. Some bank have adopted this format by default, but each others can have a different format style. This module allows you to create a cemtext format by your own style\u0026mdash;that means you can use it to meet your bank cemtext requirements. This module is fast, easy to understand, and more humanable.\n\n### Installation\nNPM\n\n```console\nnpm install vcmcemtex --save\n```\n\nBrowser\n\n```js\n// Bower\nbower install vcmcemtex --save\n```\n\n### Initialization\nNPM\n\n```js\nconst vcmcemtex = require('vcmcemtex');\n```\n\nBrowser\n\n```js\n// Bower\n\u003cscript src=\"bower_components/vcmcemtex/dist/vcmcemtex.min.js\"\u003e\u003c/script\u003e\n```\n\n# Quickstart\n\n```js\nvcmcemtex(params, options[optional]).then(cemtex =\u003e {\n  console.log(cemtex);\n});\n```\n\n- Arguments\n  - *object* **params**\n    - *object* **header** [optional]\n    - *object* **detail** [optional]\n      - *object* **keys**\n      - *array* **data**\n    - *object* **footer** [optional]\n  - *object* **options** [optional]\n    - *string* **charlen** [optional]\n      - *default* 160\n    - *boolean* **enter** [optional]\n      - *default* false\n      - If *true* will add `\\n` (enter) at every end of string.\n\n- Attributes\n  - *string* **type**\n    - *lps* | *lpz* | *rps* | *rpz*\n    - *default* rps\n    - LPS (*Left Padding Space*)\n    - LPZ (*Left Padding Zero*)\n    - RPS (*Right Padding Space*)\n    - RPZ (*Right Padding Zero*)\n  - *number* **length**\n  - *string|integer* **value**\n    - *default* ''\n  - *string|integer* **default**\n    - *default* ''\n    - The default value to be used if there is no given value.\n  - *string* **countFromDetail**\n    - Use this if you want to count a number value from a key in params `detail`. You can see the usage on examples bellow.\n    - Only works on `header` and `footer`.\n  - *boolean* **countAllData**\n    - *default* false\n    - This will count all data in params `detail` and made it as a value.\n    - Only works on `header` and `footer`.\n  - *boolean* **removeDot**\n    - *default* false\n    - This will remove all dots.\n  - *boolean* **removeSpace**\n    - *default* false\n    - This will remove all spaces.\n  - *boolean* **decimal**\n    - *default* true\n    - This will convert float or decimal format to number.\n\nEach successful generated row in a cemtext has length that equal to `charlen`\u0026mdash;default is 160 characters. So it is 160 header length, 160 detail length (per 1 row), and 160 footer length. Example:\n\n```js\n// string | length 4\n'char'\n// string | length 8\n'username'\n\n// and the cemtext output will be like this (in single string/one row):\n\n'charusername                                                                                                                                                    '\n```\n\nYou can change default `charlen` value by passing an options in second argument.\n\nA simple cemtext format can be done like this:\n\n```js\nvcmcemtex({\n  header: {\n    header1: { type: 'lps', length: 10, value: 'header' }\n  },\n  detail: {\n    keys: {\n      detail1: { type: 'lps', length: 10 }\n    },\n    data: [\n      {\n        detail1: 'detail'\n      }\n    ]\n  },\n  footer: {\n    footer1: { type: 'lps', length: 10, value: 'footer' }\n  }\n}).then(cemtex =\u003e {\n  console.log(cemtex);\n});\n\n// output\n// '    header                                                                                                                                                          detail                                                                                                                                                          footer                                                                                                                                                      '\n```\n\n`params` object has 3 main keys; `header`, `detail`, and `footer`. You don't have to use them (optional), but it's always good to use them for best practice style.\n\nIf you prefer to use key `detail`, the key must have key `keys` and `data`. `keys` is an object, and the `data` must be an array object. The object keys between `keys` and `data` should be same, for example if `keys` has a key called `detail1`, then key `data` should contains a key called `detail1`\u0026mdash;similliar to attribute `value` in `header` and `footer`.\n\nYou can see other examples bellow:\n\n```js\nvar data = [\n  {\n    name: 'John Doe',\n    username: 'johndoe',\n    email: 'johndoe@email.com',\n    accountNumber: '123456789',\n    testAmount: '12500'\n  },\n  {\n    name: 'John Smith',\n    username: 'johnsmith',\n    email: 'johnsmith@email.com',\n    accountNumber: '123456789',\n    testAmount: '12500'\n  },\n  {\n    name: 'John Adam',\n  }\n];\n\nvcmcemtex({\n  header: {\n    record: { type: 'lps', length: 1, value: '1' },\n    branch: { type: 'lpz', value: '1234' },\n    name: { type: 'rps', value: 'HEADER NAME' },\n    date: { type: 'lpz', value: '20190211' },\n    test1: { type: 'rps', value: 'test1' },\n    test2: { type: 'rps', value: 'test2' }\n  },\n  detail: {\n    keys: {\n      name: { type: 'rps', length: 10, default: '' },\n      username: { type: 'rps', length: 10, default: '' },\n      email: { type: 'rps', length: 20, default: '' },\n      accountNumber: { type: 'lpz', length: 10, default: '' },\n      testAmount: { type: 'lpz', length: 10, default: '' }\n    },\n    data: data\n  },\n  footer: {\n    record: { type: 'lpz', length: 1, value: '3' },\n    totalData: { type: 'lpz', length: 11, countAllData: true },\n    totalAmount: { type: 'lpz', length: 11, countFromDetail: 'testAmount' }\n  }\n}, {\n  charlen: 200\n}).then(cemtex =\u003e {\n  console.log(cemtex);\n});\n\n// output\n// '11234HEADER NAME20190211test1test2                                                                                                                                                                      John Doe  johndoe   johndoe@email.com   01234567890000012500                                                                                                                                            John Smithjohnsmith johnsmith@email.com 01234567890000012500                                                                                                                                            John Adam                               00000000000000000000                                                                                                                                            30000000000300000025000                                                                                                                                                                                 '\n```\n\nUsing an option `enter`:\n\n```js\nvcmcemtex({\n  header: {\n    testHeader: { type: 'lps', length: 1, value: '1' },\n    branch: { type: 'lpz', value: '1234' },\n    name: { type: 'rps', value: 'HEADER NAME' },\n    date: { type: 'rpz', value: '20190211' },\n    test1: { type: 'rps', value: 'test1' },\n    test2: { type: 'rps', value: 'test2' }\n  },\n  footer: {\n    thisIsFooter: { type: 'lps', length: 1, value: '3' },\n    footer1: { type: 'lpz', value: '1000000' },\n    footer2: { type: 'rps', value: '2000000' }\n  }\n}, {\n  enter: true\n}).then(cemtex =\u003e {\n  console.log(cemtex);\n});\n\n// output\n// 11234HEADER NAME20190211test1test2                                                                                                                              \n// 310000002000000                                                                                                                                                 \n```\n\n# Release\n\n### Changelog\nSee [https://github.com/dalikewara/vcmcemtex/blob/master/CHANGELOG.md](https://github.com/dalikewara/vcmcemtex/blob/master/CHANGELOG.md).\n\n### Credits\nCopyright \u0026copy; 2019 [Dali Kewara](https://www.dalikewara.com).\n\n### License\n[MIT License](https://github.com/dalikewara/vcmcemtex/blob/master/LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalikewara%2Fvcmcemtex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdalikewara%2Fvcmcemtex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalikewara%2Fvcmcemtex/lists"}