{"analyzedAt":"2022-07-09T19:27:12.129Z","collected":{"metadata":{"name":"gjs-template-filler","scope":"unscoped","version":"1.2.0","description":"Populates Html template produced by vue-gjs-doc-creator and return html string with populated data","keywords":["grapesjs"],"date":"2021-10-25T22:35:07.788Z","author":{"name":"Yanik Black"},"publisher":{"username":"devprojx","email":"yanikblake@live.com"},"maintainers":[{"username":"devprojx","email":"yanikblake@live.com"}],"repository":{"type":"git","url":"git+https://github.com/devprojx/gjs-template-filler.git"},"links":{"npm":"https://www.npmjs.com/package/gjs-template-filler","homepage":"https://github.com/devprojx/gjs-template-filler#readme","repository":"https://github.com/devprojx/gjs-template-filler","bugs":"https://github.com/devprojx/gjs-template-filler/issues"},"license":"MIT","dependencies":{"cheerio":"^1.0.0-rc.10","currency.js":"^2.0.4","date-format":"^3.0.0"},"devDependencies":{"@semantic-release/changelog":"^6.0.0","@semantic-release/git":"^10.0.0","jest":"^27.2.5","semantic-release":"^18.0.0"},"releases":[{"from":"2022-06-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0},{"from":"2022-04-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":1},{"from":"2022-01-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":1},{"from":"2021-07-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":9},{"from":"2020-07-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":9}],"hasTestScript":true,"hasSelectiveFiles":true,"readme":"# gjs-template-filler\n\nPopulates Html template produced by vue-gjs-doc-creator and return html string with populated data\n\n### Installation\n\n```\nnpm i gjs-template-filler\n\nyarn add gjs-template-filler\n```\n\n## Usage\n\n```js\nimport { populateHTMLTemplate } from \"gjs-template-filler\";\n\nconst testHTML = `\n<div data-property=\"first_name\">\n\t[First Name Here]\n</div>\n<div data-property=\"last_name\">\n\t[Last Name Here]\n</div>\n<div data-property=\"date_of_birth\" data-type=\"date\">\n\t[Date Of Birth Here]\n</div>\n\n<span data-property=\"age\" data-type=\"custom\" data-append=\" years old\"></span>\n\n<span data-property=\"status\" data-default=\"N/A\">[Status Here]</span>\n\n<div data-property=\"progress\" data-type=\"percentage\" data-precision=\"2\">\n\t[Progress]\n</div>\n\n<div data-property=\"hobbies\" data-seperator=\",\">\n Hobbies: <span data-value></span>\n</div>\n\n<div>\n\tAddress: <br/>\n\t<span data-property=\"address.street\">[Street Here]</span>\n\t<span data-property=\"address.city\">[City Here]</span>\n\t<span data-property=\"address.province\">[Province Here]</span>\n\t<span data-property=\"address.country\">[Country Here]</span>\n</div>\n\n<table data-property=\"employment_details\" border=\"1\"  cellpadding=\"1\">\n  <caption style=\"text-align: left; margin-bottom: 5px\"><b>Cash Collaterals</b></caption>\n  <thead>\n\t  <tr>\n\t\t  <th data-key=\"employer\" style=\"width: 20%;\">&nbsp; Employer</th>\n\t\t  <th data-key=\"address\"  style=\"width: 12%;\">&nbsp; Address</th>\n\t\t\t<th data-key=\"salary\" data-type=\"currency\" data-number-seperator=\",\" data-symbol=\"$\" data-precision=\"2\">&nbsp; Salary</th>\n\t  </tr>\n  </thead>\n</table>\n`;\n\nconst data = {\n\tfirst_name: \"John\",\n\tlast_name: \"Doe\",\n\tdate_of_birth: \"1990-09-04\",\n\tage: 31,\n\thobbies: [\"Coding\", \"Video Games\"],\n\tprogress: 10,\n\taddress: {\n\t\tstreet: \"Main Street\",\n\t\tcity: \"Mandeville\",\n\t\tprovince: \"Manchester\",\n\t\tcountry: \"Jamaica\",\n\t},\n\temployment_details: [\n\t\t{\n\t\t\temployer: \"VTDI\",\n\t\t\taddress: \"66 Caledonia Road, Mandeville, Manchester\",\n\t\t\tsalary: 60000,\n\t\t},\n\t],\n};\n\nconst populatedHtml = populateHTMLTemplate(testHTML, testData);\n```\n\n### Formatters\n\nFormatters are denoted by the `data-type` attribute on an element and can have the value one of the following `number`, `percentage`, `currency` or `date`. If the `data-type` is not provided then the value remains as is. Formatters can also have specific options attached to them for instance, `data-precision` attribute which specify the number of decimal places to round a number to. **See options below.**\n\n### Formatter Options\n\n**Number**\n\nFormat a value to a number\n\n| Options        | Default Value | Description                                         |\n| -------------- | ------------- | --------------------------------------------------- |\n| data-precision | 0             | The number of decimal places to round the number to |\n\n**Number**\n\nFormat a value to a percentage\n\n| Options        | Default Value | Description                                         |\n| -------------- | ------------- | --------------------------------------------------- |\n| data-precision | 0             | The number of decimal places to round the number to |\n\n**Currency**\n\nFormats a value to a specific currency\n\n| Options               | Default Value | Description                                         |\n| --------------------- | ------------- | --------------------------------------------------- |\n| data-precision        | 0             | The number of decimal places to round the number to |\n| data-symbol           | $             | The currency symbol to display                      |\n| data-number-seperator | ,             | The digit separator                                 |\n\n**Date**\n\nTries to format value to the date format provided. If the date is already in the format, the `data-type` and `data-format` attribute can be left off.\n\n| Options     | Default Value | Description                                                   |\n| ----------- | ------------- | ------------------------------------------------------------- |\n| data-format | -             | See date format options below. Eg. `data-format=\"yyyy-MM-dd\"` |\n\nFormat string can be anything, but the following letters will be replaced (and leading zeroes added if necessary):\n\n- dd - date.getDate()\n- MM - date.getMonth() + 1\n- yy - date.getFullYear().toString().substring(2, 4)\n- yyyy - date.getFullYear()\n- hh - date.getHours()\n- mm - date.getMinutes()\n- ss - date.getSeconds()\n- SSS - date.getMilliseconds()\n- O - timezone offset in +hm format (note that time will be in UTC if displaying offset)\n\n**Custom**\n\nFormat value to a custom format by appending and/or prepending a custom string to it.\n\n| Options      | Default Value | Description            |\n| ------------ | ------------- | ---------------------- |\n| data-append  |               | Comes after the value  |\n| data-prepend |               | Comes before the value |"},"npm":{"downloads":[{"from":"2022-07-08T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0},{"from":"2022-07-02T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":2},{"from":"2022-06-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":12},{"from":"2022-04-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":101},{"from":"2022-01-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":158},{"from":"2021-07-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":430}],"starsCount":0},"github":{"starsCount":1,"forksCount":0,"subscribersCount":1,"issues":{"count":0,"openCount":0,"distribution":{"3600":0,"10800":0,"32400":0,"97200":0,"291600":0,"874800":0,"2624400":0,"7873200":0,"23619600":0,"70858800":0,"212576400":0},"isDisabled":false},"contributors":[{"username":"devprojx","commitsCount":9},{"username":"semantic-release-bot","commitsCount":8}],"commits":[{"from":"2022-07-02T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0},{"from":"2022-06-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0},{"from":"2022-04-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0},{"from":"2022-01-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0},{"from":"2021-07-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":39}]},"source":{"files":{"readmeSize":4866,"testsSize":7538,"hasChangelog":true},"outdatedDependencies":{"date-format":{"required":"^3.0.0","stable":"4.0.11","latest":"4.0.11"}}}},"evaluation":{"quality":{"carefulness":0.8699999999999999,"tests":0.6,"health":0.75,"branding":0},"popularity":{"communityInterest":4,"downloadsCount":33.666666666666664,"downloadsAcceleration":-0.26959665144596656,"dependentsCount":0},"maintenance":{"releasesFrequency":0.9,"commitsFrequency":0.9,"openIssues":0.9,"issuesDistribution":0.9}},"score":{"final":0.6077319925566155,"detail":{"quality":0.8217269658382096,"popularity":0.03215888834276757,"maintenance":0.9998808339576686}}}