{"id":23529577,"url":"https://github.com/jaid/px-by-default","last_synced_at":"2026-05-14T23:02:45.965Z","repository":{"id":87820086,"uuid":"237732226","full_name":"Jaid/px-by-default","owner":"Jaid","description":"If given CSS size value has no unit, px will be appended.","archived":false,"fork":false,"pushed_at":"2023-03-03T18:16:47.000Z","size":1788,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-13T23:46:09.382Z","etag":null,"topics":["css","dimensions","em","lib","library","pixels","px","rem","string","util","utility"],"latest_commit_sha":null,"homepage":"https://github.com/Jaid/px-by-default","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/Jaid.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license.txt","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},"funding":{"github":"Jaid","custom":"https://twitch.tv/products/jaidchen"}},"created_at":"2020-02-02T07:01:13.000Z","updated_at":"2021-09-17T18:45:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"25b7b32a-e844-4b83-bd34-383942bd7239","html_url":"https://github.com/Jaid/px-by-default","commit_stats":{"total_commits":41,"total_committers":2,"mean_commits":20.5,"dds":"0.24390243902439024","last_synced_commit":"f53c7809e6971e4f5e2af305b65c9f2b94ebd5c2"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Jaid/px-by-default","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaid%2Fpx-by-default","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaid%2Fpx-by-default/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaid%2Fpx-by-default/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaid%2Fpx-by-default/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jaid","download_url":"https://codeload.github.com/Jaid/px-by-default/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaid%2Fpx-by-default/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000781,"owners_count":26082851,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["css","dimensions","em","lib","library","pixels","px","rem","string","util","utility"],"created_at":"2024-12-25T21:12:27.134Z","updated_at":"2025-10-08T22:13:30.051Z","avatar_url":"https://github.com/Jaid.png","language":"JavaScript","funding_links":["https://github.com/sponsors/Jaid","https://twitch.tv/products/jaidchen","https://github.com/sponsors/jaid"],"categories":[],"sub_categories":[],"readme":"# px-by-default\n\n\n\u003ca href=\"https://raw.githubusercontent.com/jaid/px-by-default/master/license.txt\"\u003e\u003cimg src=\"https://img.shields.io/github/license/jaid/px-by-default?style=flat-square\" alt=\"License\"/\u003e\u003c/a\u003e \u003ca href=\"https://github.com/sponsors/jaid\"\u003e\u003cimg src=\"https://img.shields.io/badge/\u003c3-Sponsor-FF45F1?style=flat-square\" alt=\"Sponsor px-by-default\"/\u003e\u003c/a\u003e  \n\u003ca href=\"https://actions-badge.atrox.dev/jaid/px-by-default/goto\"\u003e\u003cimg src=\"https://img.shields.io/endpoint.svg?style=flat-square\u0026url=https%3A%2F%2Factions-badge.atrox.dev%2Fjaid%2Fpx-by-default%2Fbadge\" alt=\"Build status\"/\u003e\u003c/a\u003e \u003ca href=\"https://github.com/jaid/px-by-default/commits\"\u003e\u003cimg src=\"https://img.shields.io/github/commits-since/jaid/px-by-default/v1.0.0?style=flat-square\u0026logo=github\" alt=\"Commits since v1.0.0\"/\u003e\u003c/a\u003e \u003ca href=\"https://github.com/jaid/px-by-default/commits\"\u003e\u003cimg src=\"https://img.shields.io/github/last-commit/jaid/px-by-default?style=flat-square\u0026logo=github\" alt=\"Last commit\"/\u003e\u003c/a\u003e \u003ca href=\"https://github.com/jaid/px-by-default/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/jaid/px-by-default?style=flat-square\u0026logo=github\" alt=\"Issues\"/\u003e\u003c/a\u003e  \n\u003ca href=\"https://npmjs.com/package/px-by-default\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/px-by-default?style=flat-square\u0026logo=npm\u0026label=latest%20version\" alt=\"Latest version on npm\"/\u003e\u003c/a\u003e \u003ca href=\"https://github.com/jaid/px-by-default/network/dependents\"\u003e\u003cimg src=\"https://img.shields.io/librariesio/dependents/npm/px-by-default?style=flat-square\u0026logo=npm\" alt=\"Dependents\"/\u003e\u003c/a\u003e \u003ca href=\"https://npmjs.com/package/px-by-default\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/px-by-default?style=flat-square\u0026logo=npm\" alt=\"Downloads\"/\u003e\u003c/a\u003e\n\n**If given CSS size value has no unit, px will be appended.**\n\n\n\n\n\n## Installation\n\n\u003ca href=\"https://npmjs.com/package/px-by-default\"\u003e\u003cimg src=\"https://img.shields.io/badge/npm-px--by--default-C23039?style=flat-square\u0026logo=npm\" alt=\"px-by-default on npm\"/\u003e\u003c/a\u003e\n\n```bash\nnpm install --save px-by-default@^1.0.0\n```\n\n\u003ca href=\"https://yarnpkg.com/package/px-by-default\"\u003e\u003cimg src=\"https://img.shields.io/badge/Yarn-px--by--default-2F8CB7?style=flat-square\u0026logo=yarn\u0026logoColor=white\" alt=\"px-by-default on Yarn\"/\u003e\u003c/a\u003e\n\n```bash\nyarn add px-by-default@^1.0.0\n```\n\n\u003ca href=\"https://github.com/jaid/px-by-default/packages\"\u003e\u003cimg src=\"https://img.shields.io/badge/GitHub Packages-@jaid/px--by--default-24282e?style=flat-square\u0026logo=github\" alt=\"@jaid/px-by-default on GitHub Packages\"/\u003e\u003c/a\u003e  \n(if [configured properly](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-npm-for-use-with-github-packages))\n\n```bash\nnpm install --save @jaid/px-by-default@^1.0.0\n```\n\n\n\n## Example\n\n\n```javascript\nimport pxByDefault from \"px-by-default\"\n\nconst result = pxByDefault(30)\nconst result2 = pxByDefault(\"1.5em\")\n```\n\nVariable `result` will be:\n\n```javascript\n\"30px\"\n```\nVariable `result2` will be:\n\n```javascript\n\"1.5em\"\n```\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Development\n\n\n\nSetting up:\n```bash\ngit clone git@github.com:jaid/px-by-default.git\ncd px-by-default\nnpm install\n```\nTesting:\n```bash\nnpm run test:dev\n```\nTesting in production environment:\n```bash\nnpm run test\n```\n\n\n## License\n```text\nMIT License\n\nCopyright © 2020, Jaid \u003cjaid.jsx@gmail.com\u003e (github.com/jaid)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaid%2Fpx-by-default","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaid%2Fpx-by-default","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaid%2Fpx-by-default/lists"}