| Leo Repp | 58b9f11 | 2021-11-22 11:57:47 +0100 | [diff] [blame^] | 1 | /*! |
| 2 | * global-modules <https://github.com/jonschlinkert/global-modules> |
| 3 | * |
| 4 | * Copyright (c) 2015-2017 Jon Schlinkert. |
| 5 | * Licensed under the MIT license. |
| 6 | */ |
| 7 | |
| 8 | 'use strict'; |
| 9 | |
| 10 | var path = require('path'); |
| 11 | var prefix = require('global-prefix'); |
| 12 | var isWindows = require('is-windows'); |
| 13 | var gm; |
| 14 | |
| 15 | function getPath() { |
| 16 | if (isWindows()) { |
| 17 | return path.resolve(prefix, 'node_modules'); |
| 18 | } |
| 19 | return path.resolve(prefix, 'lib/node_modules'); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Expose `global-modules` path |
| 24 | */ |
| 25 | |
| 26 | Object.defineProperty(module, 'exports', { |
| 27 | enumerable: true, |
| 28 | get: function() { |
| 29 | return gm || (gm = getPath()); |
| 30 | } |
| 31 | }); |