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

dotenv-tool

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotenv-tool - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

test/delete.test.ts

2

package.json

@@ -30,3 +30,3 @@ {

},
"version": "0.0.2",
"version": "0.1.0",
"devDependencies": {

@@ -33,0 +33,0 @@ "@types/node": "^20.11.26",

@@ -159,3 +159,3 @@ import { readFile, writeFile } from 'node:fs/promises'

const dataLine = this.findKey(key)
if (dataLine != null) {
if (dataLine !== undefined) {
dataLine.data.value = newValue

@@ -165,2 +165,23 @@ }

deleteKey (key: string): void {
let keyLineNumber: number
const newContent: Line[] = []
this.contents.forEach((line) => {
if (Number.isInteger(keyLineNumber)) {
if (line.lineNumber > keyLineNumber) {
line.lineNumber--
}
newContent.push(line)
} else {
if (line.type === 'data' && line.data.key === key) {
keyLineNumber = line.lineNumber
} else {
newContent.push(line)
}
}
})
this.nextLine--
this.contents = newContent
}
private findKey (key: string): DataLine | undefined {

@@ -167,0 +188,0 @@ const theKey = this.contents.find((line) => {

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