Socket
Socket
Sign inDemoInstall

is-text-path

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 2.0.0

index.d.ts

13

index.js
'use strict';
var path = require('path');
var textExtensions = require('text-extensions');
var exts = Object.create(null);
const path = require('path');
const textExtensions = require('text-extensions');
textExtensions.forEach(function (el) {
exts[el] = true;
});
const extensions = new Set(textExtensions);
module.exports = function (filepath) {
return path.extname(filepath).slice(1).toLowerCase() in exts;
};
module.exports = filePath => extensions.has(path.extname(filePath).slice(1).toLowerCase());
{
"name": "is-text-path",
"version": "1.0.1",
"description": "Check if a filepath is a text file",
"license": "MIT",
"repository": "sindresorhus/is-text-path",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "node test.js"
},
"files": [
"index.js"
],
"keywords": [
"txt",
"text",
"ext",
"extensions",
"extension",
"file",
"path",
"check",
"detect",
"is"
],
"dependencies": {
"text-extensions": "^1.0.0"
},
"devDependencies": {
"ava": "0.0.4"
}
"name": "is-text-path",
"version": "2.0.0",
"description": "Check if a file path is a text file",
"license": "MIT",
"repository": "sindresorhus/is-text-path",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"text",
"extensions",
"extension",
"file",
"path",
"check",
"detect",
"is"
],
"dependencies": {
"text-extensions": "^2.0.0"
},
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}
# is-text-path [![Build Status](https://travis-ci.org/sindresorhus/is-text-path.svg?branch=master)](https://travis-ci.org/sindresorhus/is-text-path)
> Check if a filepath is a text file
> Check if a file path is a text file

@@ -9,3 +9,3 @@

```
$ npm install --save is-text-path
$ npm install is-text-path
```

@@ -17,8 +17,8 @@

```js
var isTextPath = require('is-text-path');
const isTextPath = require('is-text-path');
isTextPath('src/unicorn.txt');
isTextPath('source/unicorn.txt');
//=> true
isTextPath('src/unicorn.png');
isTextPath('source/unicorn.png');
//=> false

@@ -31,3 +31,3 @@ ```

- [`text-extensions`](https://github.com/sindresorhus/text-extensions) - List of text file extensions
- [`is-binary-path`](https://github.com/sindresorhus/is-binary-path) - Check if a filepath is a binary file
- [`is-binary-path`](https://github.com/sindresorhus/is-binary-path) - Check if a file path is a binary file

@@ -37,2 +37,2 @@

MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://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