{"id":21593784,"url":"https://github.com/protoss78/decimal-behavior","last_synced_at":"2026-01-04T07:11:05.645Z","repository":{"id":57741560,"uuid":"52733037","full_name":"Protoss78/decimal-behavior","owner":"Protoss78","description":"A decimal-behavior element that provides ceil, round, floor, format and decimalAdjustemnt methods. Decimal adjustment of a number implementation is taken from Mozilla Developer Network: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round.","archived":false,"fork":false,"pushed_at":"2017-05-30T18:39:32.000Z","size":11878,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T18:04:45.317Z","etag":null,"topics":["behavior","ceil","decimal","decimal-behavior","floor","round"],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/Protoss78.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-28T17:16:35.000Z","updated_at":"2017-02-28T08:28:52.000Z","dependencies_parsed_at":"2022-08-30T14:51:36.235Z","dependency_job_id":null,"html_url":"https://github.com/Protoss78/decimal-behavior","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Protoss78%2Fdecimal-behavior","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Protoss78%2Fdecimal-behavior/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Protoss78%2Fdecimal-behavior/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Protoss78%2Fdecimal-behavior/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Protoss78","download_url":"https://codeload.github.com/Protoss78/decimal-behavior/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244206694,"owners_count":20416086,"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":["behavior","ceil","decimal","decimal-behavior","floor","round"],"created_at":"2024-11-24T17:14:41.542Z","updated_at":"2026-01-04T07:11:05.329Z","avatar_url":"https://github.com/Protoss78.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/Protoss78/decimal-behavior)\n\n# decimal-behavior\n\nA decimal-behavior element that provides ceil, round, floor, format and decimalAdjustemnt methods. \nDecimal adjustment of a number implementation is taken from Mozilla Developer Network: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round.\n\nAPI documentation and live demo can be found on the \u003ca href=\"http://protoss78.github.io/decimal-behavior\"\u003ecomponent page\u003c/a\u003e\n\n## Installation\nInstall using bower\n\n    bower i decimal-behavior -S\n\nImport the behavior\n\n    \u003clink rel=\"import\" href=\"../bower_components/decimal-behavior/decimal-behavior.html\"\u003e\n\nInlude the behavior in your web component\n\n    behaviors: [DecimalBehavior]\n\n## Example\n\u003c!---\n```\n\u003ccustom-element-demo\u003e\n  \u003ctemplate\u003e\n    \u003cscript src=\"../webcomponentsjs/webcomponents-lite.js\"\u003e\u003c/script\u003e\n    \u003clink rel=\"import\" href=\"decimal-behavior.html\"\u003e\n    \u003cnext-code-block\u003e\u003c/next-code-block\u003e\n  \u003c/template\u003e\n\u003c/custom-element-demo\u003e\n```\n--\u003e\n```html\n\u003cdom-module id=\"x-decimal-behavior\"\u003e\n  \u003ctemplate\u003e\n    \u003cstyle\u003e\n      :host {\n        display: inline-block;\n      }\n    \u003c/style\u003e\n    \u003ch1\u003edecimal-behavior\u003c/h1\u003e\n    \u003cdiv\u003eround: [[formatNumber(3.125, 2)]]\u003c/div\u003e            \n    \u003cdiv\u003efloor: [[formatNumber(3.1415, 3, 'floor')]]\u003c/div\u003e  \n    \u003cdiv\u003eceil : [[formatNumber(3.14151, 4, 'ceil')]]\u003c/div\u003e\n  \u003c/template\u003e\n  \u003cscript\u003e\n    Polymer({\n      is: 'x-decimal-behavior',\n      behaviors: [DecimalBehavior]\n    });\n  \u003c/script\u003e\n\u003c/dom-module\u003e\n\u003cx-decimal-behavior\u003e\u003c/x-decimal-behavior\u003e\n```\n\n## Methods\n### round(value, exp)\nDecimal adjustment of a number using the round method.\n* value: The number to be adjusted\n* exp: The exponent (the 10 logarithm of the adjustment base). -1 = round to 1 decimal\n \n### floor(value, exp)\nDecimal adjustment of a number using the floor method.\n* value: The number to be adjusted\n* exp: The exponent (the 10 logarithm of the adjustment base). -1 = round to 1 decimal\n\n### ceil(value, exp)\nDecimal adjustment of a number using the ceil method.\n* value: The number to be adjusted\n* exp: The exponent (the 10 logarithm of the adjustment base). -1 = round to 1 decimal\n\n### formatNumber(value, decimals, type)\nAdjusts and formats the passed value to the specified number of decimals using the passed adjustment type. \nThe toFixed function is used to  cut off the String representation.\n* value: The number to be adjusted\n* decimals: The number of decimals (is converted into an exponent). Example 1 = 1 decimal position\n* type: The adjustment type: round, floor or ceil. round is set as default.\n\n### decimalAdjust(type, value, exp)\nDecimal adjustment of a number.\nOriginal implementation from Mozilla Developer Network: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round\n* type: The adjustment type: round, floor or ceil\n* value: The number to be adjusted\n* exp: The exponent (the 10 logarithm of the adjustment base). -1 = round to 1 decimal\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotoss78%2Fdecimal-behavior","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprotoss78%2Fdecimal-behavior","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotoss78%2Fdecimal-behavior/lists"}