Socket
Socket
Sign inDemoInstall

null-check

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 3.0.0

16

index.js

@@ -1,9 +0,9 @@

'use strict';
module.exports = function (pth) {
if (String(pth).indexOf('\u0000') !== -1) {
var err = new Error('Path must be a string without null bytes.');
err.code = 'ENOENT';
export default function nullCheck(path) {
if (!path.includes('\u0000')) {
return;
}
throw err;
}
};
const error = new Error('Path must be a string without null bytes.');
error.code = 'ENOENT';
throw error;
}
{
"name": "null-check",
"version": "2.0.0",
"description": "Ensure a path doesn't contain null bytes",
"license": "MIT",
"repository": "sindresorhus/null-check",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"built-in",
"core",
"ponyfill",
"polyfill",
"shim",
"fs",
"path",
"null",
"bytes",
"check"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
"name": "null-check",
"version": "3.0.0",
"description": "Ensure a path doesn't contain null bytes",
"license": "MIT",
"repository": "sindresorhus/null-check",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"built-in",
"core",
"ponyfill",
"polyfill",
"shim",
"fs",
"path",
"null",
"bytes",
"check"
],
"devDependencies": {
"ava": "^3.15.0",
"xo": "^0.39.1"
}
}

@@ -1,28 +0,22 @@

# null-check [![Build Status](https://travis-ci.org/sindresorhus/null-check.svg?branch=master)](https://travis-ci.org/sindresorhus/null-check)
# null-check
> Ensure a path doesn't contain [null bytes](http://en.wikipedia.org/wiki/Null_character)
> Ensure a path doesn't contain [null bytes](https://en.wikipedia.org/wiki/Null_character)
## Install
```
$ npm install --save null-check
$ npm install null-check
```
## Usage
```js
const nullCheck = require('null-check');
import nullCheck from 'null-check';
try {
nullCheck('unicorn.png\u0000');
} catch (err) {
} catch (error) {
console.log(error);
//=> 'Path must be a string without null bytes.'
}
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc