Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

easypathutil

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easypathutil - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

src/deps/traps/$back.js

9

index.js
'use strict';
Reflect.defineProperty(exports, '__esModule', { value: true });
module.exports = require('./src/struct/PathBuilder').default;
const PathBuilder = require('./src/struct/PathBuilder').default;
const version = PathBuilder(__dirname)['package.json'].$json.version;
Object.defineProperties(PathBuilder, {
version: { value: version },
VERSION: { value: version },
});
module.exports = PathBuilder;

5

package.json
{
"name": "easypathutil",
"version": "1.1.1",
"version": "1.2.0",
"description": "Fluent filepaths, made simple.",
"main": "index.js",
"scripts": {
"test": "node index.js"
"test": "node index.js",
"lint": "eslint ."
},

@@ -9,0 +10,0 @@ "repository": {

@@ -22,5 +22,10 @@ <div align="center">

npm install easypathutil@1.1.1
npm install easypathutil@1.2.0
## New in 1.1.0
### New in 1.2.0
• Completely refactored internals that power the fluent API
• Provide your own Promise library
### New in 1.1.0
• Provide your own JSON, path, or fs objects

@@ -40,3 +45,3 @@

• Lightweight: Package size under 7kB
• Updated and Lightweight: Package size ~7kB

@@ -82,2 +87,3 @@ The tutorial below aims to demonstrate the core functionality of this package.

path: somePathPackage || require('path'),
Promise: somePromisePackage || global.Promise,
});

@@ -111,5 +117,5 @@

// The following will hence be true or resolve to true:
myjsfilebuffer === await myjsfilebufferpromise
myjsfilebuffer !== await myjsfilebufferpromise
myjsfilebuffer.toString() === (await myjsfilebufferpromise).toString()
myjsfilebufferpromise.then(filedata => filedata === myjsfilebuffer)
myjsfilebufferpromise.then(filedata => filedata !== myjsfilebuffer)
myjsfilebufferpromise.then(filedata => filedata.toString() === myjsfilebuffer.toString())

@@ -189,2 +195,7 @@

**Version**
const version = require('easypathutil').version;
version === require('easypathutil').VERSION;
This package adapts as needs arise, and although it has been tested on some versions of node v8 and v10, problems may still occur.

@@ -191,0 +202,0 @@

@@ -5,2 +5,3 @@ 'use strict';

const { traps: { has, get } } = require('../deps');
const ReadHelper = require('./ReadHelper').default;

@@ -11,4 +12,5 @@ function PathBuilder(base = process.cwd(), {

fs = require('fs'),
Promise = global.Promise,
} = {}, parts = []) {
if (!(this instanceof PathBuilder)) return new PathBuilder(base, { JSON, path, fs }, parts);
if (!(this instanceof PathBuilder)) return new PathBuilder(base, { JSON, path, fs, Promise }, parts);
this.base = base;

@@ -19,2 +21,4 @@ this.parts = parts;

this._fs = fs;
this._Promise = Promise;
this.read_dir = new ReadHelper(this, { fs, path, Promise });

@@ -28,5 +32,13 @@ // Perform basic checks on potentially user-defined functions

/*\
* The hard Promise safety check has been disabled due to the wide variety of Promise libraries out there.
* If you plan to provide your own Promise library, ensure that it can be constructed as a normal Promise and .then works as intended.
\*/
// if (typeof Reflect.get(this._Promise, 'resolve') !== 'function') {
// throw new Error('Invalid Promise object, "resolve" function property missing!');
// }
const proxy = this.proxy = new Proxy((arga => {
if (!arga) return this._path.join(this.base, ...this.parts);
return new PathBuilder(this.base, { JSON, path, fs }, [...this.parts, arga.toString()]);
return new PathBuilder(this.base, { JSON, path, fs, Promise }, [...this.parts, arga.toString()]);
}).bind(this), { has: has.bind(this), get: get.bind(this) });

@@ -33,0 +45,0 @@ return proxy;

Sorry, the diff of this file is not supported yet

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