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

js-refactor

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-refactor - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

4

dist/index.js

@@ -115,3 +115,3 @@ #! /usr/bin/env node

const newline = line.substr(0, m.index) + line.substr(m.index).replace(dep, newDep);
console.log('update file: %s\n %s\n->%s\n\n', file, line, newline);
console.log('update file: %s\n %s\n->%s\n', file, line, newline);
lines[ii] = newline;

@@ -154,3 +154,3 @@ }

const newline = line.substr(0, m.index) + line.substr(m.index).replace(dep, newDep);
console.log('update file: %s\n %s\n->%s\n\n', file, line, newline);
console.log('update file: %s\n %s\n->%s\n', file, line, newline);
lines[ii] = newline;

@@ -157,0 +157,0 @@ }

@@ -25,9 +25,11 @@ 'use strict';

function addTrailingSlash(dir) {
if (/\/$/.test(dir)) {
return dir;
}
return `${dir}/`;
}
function isSuperDir(superDir, childDir) {
let norm1 = _path2.default.normalize(superDir);
const norm2 = _path2.default.normalize(childDir);
if (!/\/$/.test(norm1)) {
norm1 = `${norm1}/`;
}
return norm2.startsWith(norm1);
return addTrailingSlash(childDir).startsWith(addTrailingSlash(superDir));
}
{
"name": "js-refactor",
"version": "1.0.3",
"version": "1.0.4",
"description": "mv file/directory around keeping require and import statements in sync",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -104,3 +104,3 @@ #! /usr/bin/env node

const newline = line.substr(0, m.index) + line.substr(m.index).replace(dep, newDep);
console.log('update file: %s\n %s\n->%s\n\n', file, line, newline);
console.log('update file: %s\n %s\n->%s\n', file, line, newline);
lines[ii] = newline;

@@ -149,3 +149,3 @@ }

line.substr(m.index).replace(dep, newDep);
console.log('update file: %s\n %s\n->%s\n\n', file, line, newline);
console.log('update file: %s\n %s\n->%s\n', file, line, newline);
lines[ii] = newline;

@@ -152,0 +152,0 @@ }

@@ -9,9 +9,12 @@ import path from 'path';

export function isSuperDir(superDir, childDir) {
let norm1 = path.normalize(superDir);
const norm2 = path.normalize(childDir);
if (!/\/$/.test(norm1)) {
norm1 = `${norm1}/`;
function addTrailingSlash(dir) {
if (/\/$/.test(dir)) {
return dir;
}
return norm2.startsWith(norm1);
return `${dir}/`;
}
export function isSuperDir(superDir, childDir) {
return addTrailingSlash(childDir)
.startsWith(addTrailingSlash(superDir));
}
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