{"id":17445986,"url":"https://github.com/jamen/css-get-unit","last_synced_at":"2025-09-12T10:38:58.673Z","repository":{"id":57210901,"uuid":"66981766","full_name":"jamen/css-get-unit","owner":"jamen","description":"Strip the unit off a CSS number.","archived":false,"fork":false,"pushed_at":"2017-02-06T07:29:08.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-26T15:21:13.407Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jamen.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-30T22:17:25.000Z","updated_at":"2021-12-19T15:39:51.000Z","dependencies_parsed_at":"2022-09-01T08:11:59.592Z","dependency_job_id":null,"html_url":"https://github.com/jamen/css-get-unit","commit_stats":null,"previous_names":["jamen/css-strip-units"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fcss-get-unit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fcss-get-unit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fcss-get-unit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fcss-get-unit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamen","download_url":"https://codeload.github.com/jamen/css-get-unit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234144043,"owners_count":18786288,"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":[],"created_at":"2024-10-17T18:19:44.763Z","updated_at":"2025-01-16T03:25:27.778Z","avatar_url":"https://github.com/jamen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# css-get-unit [![NPM version](https://badge.fury.io/js/css-get-unit.svg)](https://npmjs.org/package/css-get-unit) [![Build Status](https://travis-ci.org/jamen/css-get-unit.svg?branch=master)](https://travis-ci.org/jamen/css-get-unit)\n\n\u003e Get unit from a CSS value\n\n```js\nvar unit = require('css-get-unit')\n\nunit('1px')\n// =\u003e 'px'\n\nunit('30.5kHz')\n// =\u003e 'kHz'\n\nunit('auto')\n// =\u003e null\n```\n\nThis module gets unit from the CSS value without verifying.  If there is no unit it will return `null`.  To get the number instead, just use `parseFloat`:\n\n```javascript\nvar value = '100px'\n\n// User css-get-unit to get unit:\nvar unit = unit(value)\n// =\u003e 'px'\n\n// Use parseFloat to get number:\nvar number = parseFloat(value)\n// =\u003e 100\n```\n\n## Installation\n\n```sh\n$ npm install --save css-get-unit\n```\n\n## Usage\n\n### `unit(value)`\n\n - `value` (`String`): CSS value to get the unit from\n\n```javascript\nunit('2px')\n// =\u003e 'px'\n\nunit('.5ms')\n// =\u003e 'ms'\n\nunit('100')\n// =\u003e null\n```\n\n## License\n\nMIT © [Jamen Marz](https://github.com/jamen)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fcss-get-unit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamen%2Fcss-get-unit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fcss-get-unit/lists"}