├── .editorconfig
├── .eslintrc.json
├── .gitattributes
├── .gitignore
├── .travis.yml
├── .verb.md
├── LICENSE
├── README.md
├── index.js
├── package.json
└── test.js
/.editorconfig:
--------------------------------------------------------------------------------
1 | # http://editorconfig.org/
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | end_of_line = lf
7 | indent_size = 2
8 | indent_style = space
9 | insert_final_newline = true
10 | trim_trailing_whitespace = true
11 |
12 | [{**/{actual,fixtures,expected,templates}/**,*.md}]
13 | trim_trailing_whitespace = false
14 | insert_final_newline = false
15 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "eslint:recommended"
4 | ],
5 |
6 | "env": {
7 | "browser": false,
8 | "es6": true,
9 | "node": true,
10 | "mocha": true
11 | },
12 |
13 | "parserOptions":{
14 | "ecmaVersion": 9,
15 | "sourceType": "module",
16 | "ecmaFeatures": {
17 | "modules": true,
18 | "experimentalObjectRestSpread": true
19 | }
20 | },
21 |
22 | "globals": {
23 | "document": false,
24 | "navigator": false,
25 | "window": false
26 | },
27 |
28 | "rules": {
29 | "accessor-pairs": 2,
30 | "arrow-spacing": [2, { "before": true, "after": true }],
31 | "block-spacing": [2, "always"],
32 | "brace-style": [2, "1tbs", { "allowSingleLine": true }],
33 | "comma-dangle": [2, "never"],
34 | "comma-spacing": [2, { "before": false, "after": true }],
35 | "comma-style": [2, "last"],
36 | "constructor-super": 2,
37 | "curly": [2, "multi-line"],
38 | "dot-location": [2, "property"],
39 | "eol-last": 2,
40 | "eqeqeq": [2, "allow-null"],
41 | "generator-star-spacing": [2, { "before": true, "after": true }],
42 | "handle-callback-err": [2, "^(err|error)$" ],
43 | "indent": [2, 2, { "SwitchCase": 1 }],
44 | "key-spacing": [2, { "beforeColon": false, "afterColon": true }],
45 | "keyword-spacing": [2, { "before": true, "after": true }],
46 | "new-cap": [2, { "newIsCap": true, "capIsNew": false }],
47 | "new-parens": 2,
48 | "no-array-constructor": 2,
49 | "no-caller": 2,
50 | "no-class-assign": 2,
51 | "no-cond-assign": 2,
52 | "no-const-assign": 2,
53 | "no-control-regex": 2,
54 | "no-debugger": 2,
55 | "no-delete-var": 2,
56 | "no-dupe-args": 2,
57 | "no-dupe-class-members": 2,
58 | "no-dupe-keys": 2,
59 | "no-duplicate-case": 2,
60 | "no-empty-character-class": 2,
61 | "no-eval": 2,
62 | "no-ex-assign": 2,
63 | "no-extend-native": 2,
64 | "no-extra-bind": 2,
65 | "no-extra-boolean-cast": 2,
66 | "no-extra-parens": [2, "functions"],
67 | "no-fallthrough": 2,
68 | "no-floating-decimal": 2,
69 | "no-func-assign": 2,
70 | "no-implied-eval": 2,
71 | "no-inner-declarations": [2, "functions"],
72 | "no-invalid-regexp": 2,
73 | "no-irregular-whitespace": 2,
74 | "no-iterator": 2,
75 | "no-label-var": 2,
76 | "no-labels": 2,
77 | "no-lone-blocks": 2,
78 | "no-mixed-spaces-and-tabs": 2,
79 | "no-multi-spaces": 2,
80 | "no-multi-str": 2,
81 | "no-multiple-empty-lines": [2, { "max": 1 }],
82 | "no-native-reassign": 0,
83 | "no-negated-in-lhs": 2,
84 | "no-new": 2,
85 | "no-new-func": 2,
86 | "no-new-object": 2,
87 | "no-new-require": 2,
88 | "no-new-wrappers": 2,
89 | "no-obj-calls": 2,
90 | "no-octal": 2,
91 | "no-octal-escape": 2,
92 | "no-proto": 0,
93 | "no-redeclare": 2,
94 | "no-regex-spaces": 2,
95 | "no-return-assign": 2,
96 | "no-self-compare": 2,
97 | "no-sequences": 2,
98 | "no-shadow-restricted-names": 2,
99 | "no-spaced-func": 2,
100 | "no-sparse-arrays": 2,
101 | "no-this-before-super": 2,
102 | "no-throw-literal": 2,
103 | "no-trailing-spaces": 0,
104 | "no-undef": 2,
105 | "no-undef-init": 2,
106 | "no-unexpected-multiline": 2,
107 | "no-unneeded-ternary": [2, { "defaultAssignment": false }],
108 | "no-unreachable": 2,
109 | "no-unused-vars": [2, { "vars": "all", "args": "none" }],
110 | "no-useless-call": 0,
111 | "no-with": 2,
112 | "one-var": [0, { "initialized": "never" }],
113 | "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }],
114 | "padded-blocks": [0, "never"],
115 | "quotes": [2, "single", "avoid-escape"],
116 | "radix": 2,
117 | "semi": [2, "always"],
118 | "semi-spacing": [2, { "before": false, "after": true }],
119 | "space-before-blocks": [2, "always"],
120 | "space-before-function-paren": [2, "never"],
121 | "space-in-parens": [2, "never"],
122 | "space-infix-ops": 2,
123 | "space-unary-ops": [2, { "words": true, "nonwords": false }],
124 | "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }],
125 | "use-isnan": 2,
126 | "valid-typeof": 2,
127 | "wrap-iife": [2, "any"],
128 | "yoda": [2, "never"]
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Enforce Unix newlines
2 | * text eol=lf
3 |
4 | # binaries
5 | *.ai binary
6 | *.psd binary
7 | *.jpg binary
8 | *.gif binary
9 | *.png binary
10 | *.jpeg binary
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # always ignore files
2 | *.DS_Store
3 | .idea
4 | .vscode
5 | *.sublime-*
6 |
7 | # test related, or directories generated by tests
8 | test/actual
9 | actual
10 | coverage
11 | .nyc*
12 |
13 | # npm
14 | node_modules
15 | npm-debug.log
16 |
17 | # yarn
18 | yarn.lock
19 | yarn-error.log
20 |
21 | # misc
22 | _gh_pages
23 | _draft
24 | _drafts
25 | bower_components
26 | vendor
27 | temp
28 | tmp
29 | TODO.md
30 | package-lock.json
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 | os:
3 | - linux
4 | - osx
5 | language: node_js
6 | node_js:
7 | - node
8 | - '9'
9 | - '8'
10 | - '7'
11 | - '6'
12 | - '5'
13 | - '4'
14 | - '0.12'
15 | - '0.10'
16 |
--------------------------------------------------------------------------------
/.verb.md:
--------------------------------------------------------------------------------
1 | ## Heads up!
2 |
3 | As of `v0.2.0` this module always returns a function.
4 |
5 | ## Node.js usage
6 |
7 | ```js
8 | var isWindows = require('{%= name %}');
9 |
10 | console.log(isWindows());
11 | //=> returns true if the platform is windows
12 | ```
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015-2018, Jon Schlinkert.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # is-windows [](https://www.npmjs.com/package/is-windows) [](https://npmjs.org/package/is-windows) [](https://npmjs.org/package/is-windows) [](https://travis-ci.org/jonschlinkert/is-windows)
2 |
3 | > Returns true if the platform is windows. UMD module, works with node.js, commonjs, browser, AMD, electron, etc.
4 |
5 | Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
6 |
7 | ## Install
8 |
9 | Install with [npm](https://www.npmjs.com/):
10 |
11 | ```sh
12 | $ npm install --save is-windows
13 | ```
14 |
15 | ## Heads up!
16 |
17 | As of `v0.2.0` this module always returns a function.
18 |
19 | ## Node.js usage
20 |
21 | ```js
22 | var isWindows = require('is-windows');
23 |
24 | console.log(isWindows());
25 | //=> returns true if the platform is windows
26 | ```
27 |
28 | ## About
29 |
30 |
31 | Contributing
32 |
33 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
34 |
35 |
36 |
37 |
38 | Running Tests
39 |
40 | Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
41 |
42 | ```sh
43 | $ npm install && npm test
44 | ```
45 |
46 |
47 |
48 |
49 | Building docs
50 |
51 | _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
52 |
53 | To generate the readme, run the following command:
54 |
55 | ```sh
56 | $ npm install -g verbose/verb#dev verb-generate-readme && verb
57 | ```
58 |
59 |
60 |
61 | ### Related projects
62 |
63 | You might also be interested in these projects:
64 |
65 | * [is-absolute](https://www.npmjs.com/package/is-absolute): Returns true if a file path is absolute. Does not rely on the path module… [more](https://github.com/jonschlinkert/is-absolute) | [homepage](https://github.com/jonschlinkert/is-absolute "Returns true if a file path is absolute. Does not rely on the path module and can be used as a polyfill for node.js native `path.isAbolute`.")
66 | * [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
67 | * [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative "Returns `true` if the path appears to be relative.")
68 | * [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
69 | * [window-size](https://www.npmjs.com/package/window-size): Reliable way to get the height and width of terminal/console, since it's not calculated or… [more](https://github.com/jonschlinkert/window-size) | [homepage](https://github.com/jonschlinkert/window-size "Reliable way to get the height and width of terminal/console, since it's not calculated or updated the same way on all platforms, environments and node.js versions.")
70 |
71 | ### Contributors
72 |
73 | | **Commits** | **Contributor** |
74 | | --- | --- |
75 | | 11 | [jonschlinkert](https://github.com/jonschlinkert) |
76 | | 4 | [doowb](https://github.com/doowb) |
77 | | 1 | [SimenB](https://github.com/SimenB) |
78 | | 1 | [gucong3000](https://github.com/gucong3000) |
79 |
80 | ### Author
81 |
82 | **Jon Schlinkert**
83 |
84 | * [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)
85 | * [github/jonschlinkert](https://github.com/jonschlinkert)
86 | * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
87 |
88 | ### License
89 |
90 | Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
91 | Released under the [MIT License](LICENSE).
92 |
93 | ***
94 |
95 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on February 14, 2018._
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * is-windows
3 | *
4 | * Copyright © 2015-2018, Jon Schlinkert.
5 | * Released under the MIT License.
6 | */
7 |
8 | (function(factory) {
9 | if (exports && typeof exports === 'object' && typeof module !== 'undefined') {
10 | module.exports = factory();
11 | } else if (typeof define === 'function' && define.amd) {
12 | define([], factory);
13 | } else if (typeof window !== 'undefined') {
14 | window.isWindows = factory();
15 | } else if (typeof global !== 'undefined') {
16 | global.isWindows = factory();
17 | } else if (typeof self !== 'undefined') {
18 | self.isWindows = factory();
19 | } else {
20 | this.isWindows = factory();
21 | }
22 | })(function() {
23 | 'use strict';
24 | return function isWindows() {
25 | return process && (process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE));
26 | };
27 | });
28 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "is-windows",
3 | "description": "Returns true if the platform is windows. UMD module, works with node.js, commonjs, browser, AMD, electron, etc.",
4 | "version": "1.0.2",
5 | "homepage": "https://github.com/jonschlinkert/is-windows",
6 | "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
7 | "contributors": [
8 | "Jon Schlinkert (http://twitter.com/jonschlinkert)",
9 | "Simen Bekkhus (https://github.com/SimenB)",
10 | "刘祺 (gucong.co.cc)"
11 | ],
12 | "repository": "jonschlinkert/is-windows",
13 | "bugs": {
14 | "url": "https://github.com/jonschlinkert/is-windows/issues"
15 | },
16 | "license": "MIT",
17 | "files": [
18 | "index.js"
19 | ],
20 | "main": "index.js",
21 | "engines": {
22 | "node": ">=0.10.0"
23 | },
24 | "scripts": {
25 | "test": "mocha"
26 | },
27 | "devDependencies": {
28 | "gulp-format-md": "^1.0.0",
29 | "mocha": "^3.5.3"
30 | },
31 | "keywords": [
32 | "check",
33 | "cywin",
34 | "is",
35 | "is-windows",
36 | "nix",
37 | "operating system",
38 | "os",
39 | "platform",
40 | "process",
41 | "unix",
42 | "win",
43 | "win32",
44 | "windows"
45 | ],
46 | "verb": {
47 | "toc": false,
48 | "layout": "default",
49 | "tasks": [
50 | "readme"
51 | ],
52 | "plugins": [
53 | "gulp-format-md"
54 | ],
55 | "related": {
56 | "list": [
57 | "is-absolute",
58 | "is-glob",
59 | "is-relative",
60 | "isobject",
61 | "window-size"
62 | ]
63 | },
64 | "lint": {
65 | "reflinks": true
66 | },
67 | "reflinks": [
68 | "verb"
69 | ]
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | require('mocha');
4 | var assert = require('assert');
5 | var isWindows = require('./');
6 |
7 | describe('isWindows', function() {
8 | it('should return true if the platform is windows:', function() {
9 | if (process && process.platform !== 'win32' && !/^(msys|cygwin)$/.test(process.env.OSTYPE)) {
10 | assert.equal(isWindows(), false);
11 | } else {
12 | assert.equal(isWindows(), true);
13 | }
14 | });
15 | });
16 |
--------------------------------------------------------------------------------