easypathutil
Advanced tools
Comparing version
{ | ||
"name": "easypathutil", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Fluent filepaths, made simple.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -22,3 +22,3 @@ <div align="center"> | ||
npm install easypathutil@1.1.0 | ||
npm install easypathutil@1.1.1 | ||
@@ -133,3 +133,3 @@ ## New in 1.1.0 | ||
**Read directory recursively, returning an array of absolute paths to files (.$read_dir, .$read_dir_sync) | ||
**Read directory recursively, returning an array of absolute paths to files (.$read_dir, .$read_dir_sync)** | ||
@@ -181,5 +181,14 @@ const filearray = myfolder.$read_dir_sync | ||
**Existence of a file or folder (in operator, Reflect.has, etc)** | ||
const boolean_exists = 'foldername' in myfolder; | ||
const boolean_exists2 = Reflect.has(myfolder, 'filename.extension'); | ||
const boolean_exists3 = 'subfoldername' in Object.create(myfolder); | ||
This package adapts as needs arise, and although it has been tested on some versions of node v8 and v10, problems may still occur. | ||
Enjoy this package? Consider starring on [github](https://github.com/wzhouwzhou/easypathutil) and checking out some of my other work: | ||
[Youtube Search API](https://npmjs.com/ytsearcher) | ||
[Urban Dictionary](https://npmjs.com/easyurban) |
@@ -18,2 +18,9 @@ 'use strict'; | ||
// Perform basic checks on potentially user-defined functions | ||
const empty = ['JSON', 'path', 'fs'].find(e => typeof this[`_${e}`] !== 'object' || this[`_${e}`] === null); | ||
if (empty) throw new Error(`Dependency ${empty} must be a non-null object!`); | ||
if (typeof Reflect.get(this._JSON, 'parse') !== 'function') throw new Error('Invalid JSON object, "parse" function property missing!'); | ||
if (typeof Reflect.get(this._fs, 'statSync') !== 'function') throw new Error('Invalid fs object, "statSync" function property missing!'); | ||
if (typeof Reflect.get(this._path, 'join') !== 'function') throw new Error('Invalid path object, "join" function property missing!'); | ||
const proxy = this.proxy = new Proxy((arga => { | ||
@@ -20,0 +27,0 @@ if (!arga) return this._path.join(this.base, ...this.parts); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
22250
5.25%116
5.45%192
4.92%