RaulCatalinas / GetUserOS

get-user-os is a lightweight, easy-to-use JavaScript library that provides a simple API to detect the operating system of a user. It's built with TypeScript and works seamlessly across different browsers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get-user-os

get-user-os is a lightweight, easy-to-use JavaScript library that provides a simple API to detect the operating system of a user. It's built with TypeScript and works seamlessly across different browsers.

Installation

npm install get-user-os
yarn add get-user-os
pnpm add get-user-os
bun add get-user-os

Use

import { getUserOS, UserOS } from "get-user-os"

const userOS = getUserOS();

if (userOS === UserOS.Windows) {
  console.log("The user is using Windows")
} else if (userOS === UserOS.Mac) {
  console.log("The user is using Mac")
} else if (userOS === UserOS.Linux) {
  console.log("The user is using Linux")
} else {
  console.log(`The user is using ${userOS}`)
}

Contribution

Contributions are welcome. Please open an issue or pull request for suggestions for improvements or bug fixes.

License

The license information is contained in the file LICENSE.md.

Authors

About

get-user-os is a lightweight, easy-to-use JavaScript library that provides a simple API to detect the operating system of a user. It's built with TypeScript and works seamlessly across different browsers

License:MIT License


Languages

Language:TypeScript 80.4%Language:JavaScript 19.6%