
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
simple-os-platform
Advanced tools
A helper that returns a simplified version the current user's operating system. Eg. "Windows", "Linux", "Android", "Mac", "iOS" etc.
A helper that returns the current user's operating system. Eg. "Windows", "Linux", "Android", "MacOS", "iOS" etc.
yarn add simple-os-platform
or
npm install simple-os-platform
Here's an example of a component that renders a shortcut phrase based off the user's operating system:
// ES6/ES7/ESNext
import { getOS, isMac, isNotMac } from 'simple-os-platform'
getOS(); // returns your Operating System Eg. Mac, Windows etc (see list below)
isMac(); // returns true if your operating system is a Mac
isNotMac(); // returns false if your operating system is a Mac
// CommonJS
var simpleOSPlatform = require('simple-os-platform');
simpleOSPlatform.getOS(); // returns your Operating System Eg. Mac, Windows etc (see list below)
simpleOSPlatform.isMac(); // returns true if your operating system is a Mac
simpleOSPlatform.isNotMac(); // returns false if your operating system is a Mac
If the user's operating system is a Mac
, the shortcut phrase renders cmd + click
, otherwise it renders ctrl + click
.
If the user's operating system doesn't fall under the category of any of these list items, then the window.navigator.platform
result will be returned instead.
Testing is handled by Jest
and the packages has the following commands setup
yarn test
yarn test:watch
TODO: Write Unit Tests for the isHelpers
All contributions are welcome, and can be done by cloning the repo and running yarn install
.
Ensure that there are no errors in the tests or linter and ensure that your commit messages comply to the following format:
There are git hooks configured to ensure commit message format as well as test and linter compliance.
Discover the release history by heading on over to the releases page.
Unless stated otherwise all works are:
and licensed under:
FAQs
A helper that returns a simplified version the current user's operating system. Eg. "Windows", "Linux", "Android", "Mac", "iOS" etc.
The npm package simple-os-platform receives a total of 4 weekly downloads. As such, simple-os-platform popularity was classified as not popular.
We found that simple-os-platform demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.