@npmcli/arborist
Advanced tools
Comparing version 4.1.2 to 4.2.0
@@ -1088,7 +1088,12 @@ // a module that manages a shrinkwrap file (npm-shrinkwrap.json or | ||
save (options = {}) { | ||
toJSON () { | ||
if (!this.data) { | ||
throw new Error('run load() before saving data') | ||
throw new Error('run load() before getting or setting data') | ||
} | ||
return this.commit() | ||
} | ||
toString (options = {}) { | ||
const data = this.toJSON() | ||
const { format = true } = options | ||
@@ -1099,4 +1104,10 @@ const defaultIndent = this.indent || 2 | ||
const eol = format ? this.newline || '\n' : '' | ||
const data = this.commit() | ||
const json = stringify(data, swKeyOrder, indent).replace(/\n/g, eol) | ||
return stringify(data, swKeyOrder, indent).replace(/\n/g, eol) | ||
} | ||
save (options = {}) { | ||
if (!this.data) { | ||
throw new Error('run load() before saving data') | ||
} | ||
const json = this.toString(options) | ||
return Promise.all([ | ||
@@ -1103,0 +1114,0 @@ writeFile(this.filename, json).catch(er => { |
{ | ||
"name": "@npmcli/arborist", | ||
"version": "4.1.2", | ||
"version": "4.2.0", | ||
"description": "Manage node_modules trees", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
402569
10647