Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

shescape

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shescape - npm Package Compare versions

Comparing version 1.5.3 to 1.5.4

7

CHANGELOG.md

@@ -12,2 +12,7 @@ # Changelog

## [1.5.4] - 2022-03-07
- Fix `Cannot find module 'path/win32'` error on Node.js <16.0.0. ([#199])
- Improve detection of the Windows operating system. ([#192])
## [1.5.3] - 2022-03-06

@@ -126,3 +131,5 @@

[#190]: https://github.com/ericcornelissen/shescape/pull/190
[#192]: https://github.com/ericcornelissen/shescape/pull/192
[#199]: https://github.com/ericcornelissen/shescape/pull/199
[keep a changelog]: https://keepachangelog.com/en/1.0.0/
[semantic versioning]: https://semver.org/spec/v2.0.0.html

4

index.js

@@ -11,3 +11,3 @@ /**

* @module shescape
* @version 1.5.3
* @version 1.5.4
* @license MPL-2.0

@@ -30,3 +30,3 @@ * @author Eric Cornelissen <ericornelissen@gmail.com>

const platform = os.platform();
const helpers = getHelpersByPlatform(platform);
const helpers = getHelpersByPlatform({ platform, process });
return helpers;

@@ -33,0 +33,0 @@ }

{
"name": "shescape",
"version": "1.5.3",
"version": "1.5.4",
"description": "simple shell escape library",

@@ -63,3 +63,3 @@ "homepage": "https://ericcornelissen.github.io/shescape/",

"prettier": "2.5.1",
"rollup": "2.69.0",
"rollup": "2.70.0",
"sinon": "13.0.1"

@@ -66,0 +66,0 @@ },

@@ -11,2 +11,12 @@ /**

/**
* @constant {string} cygwin The string identifying the OS type cygwin.
*/
const cygwin = "cygwin";
/**
* @constant {string} msys The string identifying the OS type msys.
*/
const msys = "msys";
/**
* @constant {string} win32 The string identifying Windows systems.

@@ -17,14 +27,33 @@ */

/**
* Check if the current platform is Windows.
*
* @param {Object} args The arguments for this function.
* @param {string} args.platform The `os.platform()` value.
* @param {Object} args.process The `process` values.
* @param {Object} args.process.env The environment variables.
* @returns {boolean} `true` iff the current platform is Windows.
*/
function isWindow({ platform, process }) {
return (
platform === win32 ||
process.env.OSTYPE === cygwin ||
process.env.OSTYPE === msys
);
}
/**
* Get all helper functions for a specific platform.
*
* @param {string} platform The platform to get the helpers for.
* @returns {Object} The helper functions for `platform`.
* @param {Object} args The arguments for this function.
* @param {string} args.platform The `os.platform()` value.
* @param {Object} args.process The `process` values.
* @param {Object} args.process.env The environment variables.
* @returns {Object} The helper functions for the current platform.
*/
export function getHelpersByPlatform(platform) {
switch (platform) {
case win32:
return win;
default:
return unix;
export function getHelpersByPlatform(args) {
if (isWindow(args)) {
return win;
}
return unix;
}

@@ -8,3 +8,3 @@ /**

import * as fs from "fs";
import * as path from "path/win32";
import * as path from "path";
import which from "which";

@@ -106,3 +106,3 @@

function getBasename(fullPath) {
return path.basename(fullPath);
return path.win32.basename(fullPath);
}

@@ -109,0 +109,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc