Socket
Socket
Sign inDemoInstall

@danmasta/walk

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@danmasta/walk - npm Package Compare versions

Comparing version 4.2.1 to 4.2.2

2

lib/file.js

@@ -216,3 +216,3 @@ const path = require('path');

async getEncodingFromBOM () {
async getEncodingFromBom () {

@@ -219,0 +219,0 @@ let buff = Buffer.alloc(4);

@@ -158,3 +158,3 @@ const path = require('path');

function notNil (val) {
function isNotNil (val) {
return val != null;

@@ -173,3 +173,3 @@ }

each(arr, (val, key) => {
if (notNil(val)) {
if (isNotNil(val)) {
fn(val, key);

@@ -187,3 +187,3 @@ }

function isModule (obj) {
return notNil(obj) && obj[Symbol.toStringTag] === 'Module';
return isNotNil(obj) && obj[Symbol.toStringTag] === 'Module';
}

@@ -206,3 +206,3 @@

exports.isNil = isNil;
exports.notNil = notNil;
exports.isNotNil = isNotNil;
exports.each = each;

@@ -209,0 +209,0 @@ exports.eachNotNil = eachNotNil;

{
"name": "@danmasta/walk",
"version": "4.2.1",
"version": "4.2.2",
"author": "Daniel Smith <dannmasta@gmail.com>",

@@ -5,0 +5,0 @@ "description": "Directory and file walking utility for node apps",

@@ -9,3 +9,3 @@ # Walk

* Simple filtering with glob pattern matching
* Require file contents or read as stream, buffer, or string
* Require or import file contents, or read as stream, buffer, or string
* Resolves require-style path strings

@@ -18,3 +18,3 @@ * Normalized file objects with helper methods

## About
I needed a better way to walk directories and read files during build and/or run time. I wanted an api that was simple, supported glob pattern matching like gulp, and returned objects with a similar format as vinyl. This package allows you to simply read any directory (or file), filter results with glob pattern matching, and return an array of file objects. It can also require file contents, read them as streams, buffers, or strings, and resolve require-style path strings.
I needed a better way to walk directories and read files during build and/or run time. I wanted an api that was simple, supported glob pattern matching like gulp, and returned objects with a similar format as vinyl. This package allows you to simply read any directory (or file), filter results with glob pattern matching, and return an array of file objects. It can also require or import file contents, read them as streams, buffers, or strings, and resolve require-style path strings.

@@ -86,5 +86,5 @@ ## Usage

`require` | Reads the file contents using `require`
`import` | Reads the file contents using `import`. Returns a promise
`requireOrImport` | Reads the file contents using `import` or `require` based on esm-ness. Returns a promise
`requireImportOrRead` | Reads the file contents using `import` or `require` if able, otherwise reads as string or buffer based on encoding. Returns a promise
`import` | Reads the file contents using `import`. Returns a `promise`
`requireOrImport` | Reads the file contents using `import` or `require` based on esm-ness. Returns a `promise`
`requireImportOrRead` | Reads the file contents using `import` or `require` if able, otherwise reads as `string` or `buffer` based on encoding. Returns a `promise`
`isModule` | Returns `true` if `file.contents` is a [`module`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import#module_namespace_object)

@@ -104,3 +104,3 @@ `isBuffer` | Returns `true` if `file.contents` is a [`buffer`](https://nodejs.org/api/buffer.html#buffer_class_method_buffer_isbuffer_obj)

`isEmpty` | Returns `true` if the file is empty (zero bytes)
`getEncodingFromBOM` | Returns the encoding from the file [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding) if set, otherwise `undefined`
`getEncodingFromBom` | Returns the encoding from the file [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding) if set, otherwise `undefined`

@@ -107,0 +107,0 @@ ### Sync

@@ -54,3 +54,3 @@ const fs = require('fs');

getEncodingFromBOM () {
getEncodingFromBom () {

@@ -57,0 +57,0 @@ let buff = Buffer.alloc(4);

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