πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
Book a DemoInstallSign in
Socket

vfile

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vfile - npm Package Compare versions

Comparing version

to
2.1.0

25

index.js
'use strict';
var path = require('path');
var has = require('has');
var replace = require('replace-ext');
var stringify = require('unist-util-stringify-position');
var buffer = require('is-buffer');
var string = require('x-is-string');
module.exports = VFile;
var own = {}.hasOwnProperty;
var proto = VFile.prototype;

@@ -41,3 +40,3 @@

options = {};
} else if (string(options) || buffer(options)) {
} else if (typeof options === 'string' || buffer(options)) {
options = {contents: options};

@@ -64,3 +63,3 @@ } else if ('message' in options && 'messages' in options) {

if (has(options, prop)) {
if (own.call(options, prop)) {
this[prop] = options[prop];

@@ -95,3 +94,3 @@ }

get: function () {
return string(this.path) ? path.dirname(this.path) : undefined;
return typeof this.path === 'string' ? path.dirname(this.path) : undefined;
},

@@ -107,3 +106,3 @@ set: function (dirname) {

get: function () {
return string(this.path) ? path.basename(this.path) : undefined;
return typeof this.path === 'string' ? path.basename(this.path) : undefined;
},

@@ -120,3 +119,3 @@ set: function (basename) {

get: function () {
return string(this.path) ? path.extname(this.path) : undefined;
return typeof this.path === 'string' ? path.extname(this.path) : undefined;
},

@@ -146,3 +145,3 @@ set: function (extname) {

get: function () {
return string(this.path) ? path.basename(this.path, this.extname) : undefined;
return typeof this.path === 'string' ? path.basename(this.path, this.extname) : undefined;
},

@@ -230,4 +229,10 @@ set: function (stem) {

proto.file = proto.name = proto.reason = proto.message = proto.stack = '';
proto.fatal = proto.column = proto.line = null;
proto.file = '';
proto.name = '';
proto.reason = '';
proto.message = '';
proto.stack = '';
proto.fatal = null;
proto.column = null;
proto.line = null;

@@ -234,0 +239,0 @@ /* Construct a new file message.

{
"name": "vfile",
"version": "2.0.1",
"version": "2.1.0",
"description": "Virtual file format for text processing",

@@ -28,7 +28,5 @@ "license": "MIT",

"dependencies": {
"has": "^1.0.1",
"is-buffer": "^1.1.4",
"replace-ext": "1.0.0",
"unist-util-stringify-position": "^1.0.0",
"x-is-string": "^0.1.0"
"unist-util-stringify-position": "^1.0.0"
},

@@ -42,6 +40,6 @@ "files": [

"nyc": "^10.0.0",
"remark-cli": "^2.0.0",
"remark-preset-wooorm": "^1.0.0",
"remark-cli": "^3.0.0",
"remark-preset-wooorm": "^3.0.0",
"tape": "^4.4.0",
"xo": "^0.17.0"
"xo": "^0.18.0"
},

@@ -66,2 +64,6 @@ "scripts": {

"space": true,
"esnext": false,
"rules": {
"unicorn/no-new-buffer": "off"
},
"ignores": [

@@ -72,4 +74,6 @@ "vfile.js"

"remarkConfig": {
"presets": "wooorm"
"plugins": [
"preset-wooorm"
]
}
}

58

readme.md

@@ -94,21 +94,21 @@ # ![vfile][]

* [`convert-vinyl-to-vfile`](https://github.com/dustinspecker/convert-vinyl-to-vfile)
β€” Convert from [Vinyl][];
β€” Convert from [Vinyl][]
* [`is-vfile-message`](https://github.com/shinnn/is-vfile-message)
β€” Check if a value is a `VFileMessage` object;
β€” Check if a value is a `VFileMessage` object
* [`to-vfile`](https://github.com/vfile/to-vfile)
β€” Create a virtual file from a file-path (and optionally read it);
β€” Create a virtual file from a file-path (and optionally read it)
* [`vfile-find-down`](https://github.com/vfile/vfile-find-down)
β€” Find files by searching the file system downwards;
β€” Find files by searching the file system downwards
* [`vfile-find-up`](https://github.com/vfile/vfile-find-up)
β€” Find files by searching the file system upwards;
β€” Find files by searching the file system upwards
* [`vfile-location`](https://github.com/vfile/vfile-location)
β€” Convert between line/column- and range-based locations;
β€” Convert between line/column- and range-based locations
* [`vfile-statistics`](https://github.com/vfile/vfile-statistics)
β€” Count messages per category;
β€” Count messages per category
* [`vfile-messages-to-vscode-diagnostics`](https://github.com/shinnn/vfile-messages-to-vscode-diagnostics)
β€” Convert to VS Code diagnostics;
β€” Convert to VS Code diagnostics
* [`vfile-sort`](https://github.com/vfile/vfile-sort)
β€” Sort messages by line/column;
* [`vfile-to-eslint`](https://github.com/sindresorhus/vfile-to-eslint)
β€” Convert VFiles to ESLint formatter compatible output.
β€” Sort messages by line/column
* [`vfile-to-eslint`](https://github.com/vfile/vfile-to-eslint)
β€” Convert VFiles to ESLint formatter compatible output

@@ -123,7 +123,7 @@ ## Reporters

* [`vfile-reporter`](https://github.com/vfile/vfile-reporter)
β€” Stylish reporter;
β€” Stylish reporter
* [`vfile-reporter-json`](https://github.com/vfile/vfile-reporter-json)
β€” JSON reporter;
* [`vfile-reporter-pretty`](https://github.com/sindresorhus/vfile-reporter-pretty)
β€” Pretty reporter.
β€” JSON reporter
* [`vfile-reporter-pretty`](https://github.com/vfile/vfile-reporter-pretty)
β€” Pretty reporter

@@ -213,8 +213,10 @@ ## API

###### Parameters
* `reason` (`string` or `Error`)
β€” Reason for message, uses the stack and message of the error if given;
β€” Reason for message, uses the stack and message of the error if given
* `position` (`Node`, `Location`, or `Position`, optional)
β€” Place at which the message occurred in `vfile`.
β€” Place at which the message occurred in `vfile`
* `ruleId` (`string`, optional)
β€” Category of warning.
β€” Category of warning

@@ -242,14 +244,14 @@ ###### Returns

* `file` (`string`) β€” File-path (when the message was triggered);
* `reason` (`string`) β€” Reason for message;
* `ruleId` (`string?`) β€” Category of message;
* `source` (`string?`) β€” Namespace of warning;
* `stack` (`string?`) β€” Stack of message;
* `file` (`string`) β€” File-path (when the message was triggered)
* `reason` (`string`) β€” Reason for message
* `ruleId` (`string?`) β€” Category of message
* `source` (`string?`) β€” Namespace of warning
* `stack` (`string?`) β€” Stack of message
* `fatal` (`boolean?`) β€” If `true`, marks associated file as no longer
processable;
* `line` (`number?`) β€” Starting line of error;
* `column` (`number?`) β€” Starting column of error;
processable
* `line` (`number?`) β€” Starting line of error
* `column` (`number?`) β€” Starting column of error
* `location` (`object`) β€” Full range information, when available. Has
`start` and `end` properties, both set to an object with `line` and
`column`, set to `number?`.
`column`, set to `number?`

@@ -278,3 +280,3 @@ ## License

[unified]: https://github.com/wooorm/unified
[unified]: https://github.com/unifiedjs/unified

@@ -281,0 +283,0 @@ [retext]: https://github.com/wooorm/retext