https://github.com/roderickqiu/cmd-or-ctrl
The main thing: returning 'command' or 'control' based on the OS the user is using; another thing: returning the common names of OSs.
https://github.com/roderickqiu/cmd-or-ctrl
Last synced: about 1 year ago
JSON representation
The main thing: returning 'command' or 'control' based on the OS the user is using; another thing: returning the common names of OSs.
- Host: GitHub
- URL: https://github.com/roderickqiu/cmd-or-ctrl
- Owner: RoderickQiu
- License: mit
- Created: 2020-02-24T11:54:30.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-25T14:25:23.000Z (about 6 years ago)
- Last Synced: 2025-02-14T09:48:40.578Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/cmd-or-ctrl
- Size: 9.77 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cmd-or-ctrl
The main thing this package does is simply returning `command` or `control` based on the OS the user is using, and the another thing is to return the common names of OSs.
[**NPM Package**](https://www.npmjs.com/package/cmd-or-ctrl) | [**CNPM**](https://npm.taobao.org/package/cmd-or-ctrl)
## How to use
```shell
# npm
npm i cmd-or-ctrl
# yarn
yarn add cmd-or-ctrl
```
```javascript
var cmdOrCtrl = require('cmd-or-ctrl');
console.log(cmdOrCtrl.cmdOrCtrl())// ctrl / cmd
console.log(cmdOrCtrl.cmdOrCtrl("short"))// ctrl / cmd
console.log(cmdOrCtrl.cmdOrCtrl("long"))// control / command
console.log(cmdOrCtrl.cmdOrCtrl("short", "pascal"))// Ctrl / Cmd
console.log(cmdOrCtrl.cmdOrCtrl("long", "pascal"))// Control / Command
console.log(cmdOrCtrl._())// alternative of `cmdOrCtrl`, returns `ctrl`
console.log(cmdOrCtrl.os());// returns 'win32' or other os name
console.log(cmdOrCtrl.os("name"));// returns 'macOS' / 'Linux' / 'Windows' or other os name
```
## Copyright
Licensed under [MIT License](https://github.com/RoderickQiu/cmd-or-ctrl/blob/master/LICENSE).
**(c) 2020 [Roderick Qiu](https://r-q.name)**.