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

smart-fs

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smart-fs - npm Package Compare versions

Comparing version 1.6.2 to 1.7.0

12

lib/logic/smart-write.js

@@ -13,2 +13,4 @@ const assert = require('assert');

const stringify = require('json-stringify-pretty-compact');
const yaml = require('yaml-boost');

@@ -27,10 +29,12 @@

const ctx = Object.assign({
treatAs: null,
mergeStrategy: (existing, changeset) => changeset,
create: true,
treatAs: null
pretty: false
}, options);
assert(Object.keys(ctx).length === 3, 'Unexpected Option provided!');
assert(Object.keys(ctx).length === 4, 'Unexpected Option provided!');
assert(ctx.treatAs === null || typeof ctx.treatAs === 'string');
assert(typeof ctx.mergeStrategy === 'function');
assert(typeof ctx.create === 'boolean');
assert(typeof ctx.pretty === 'boolean');
const targetExists = fs.existsSync(filepath);

@@ -63,3 +67,3 @@

case 'json':
contentString = `${JSON.stringify(mergedContent, null, 2)}\n`;
contentString = `${ctx.pretty ? stringify(mergedContent) : JSON.stringify(mergedContent, null, 2)}\n`;
break;

@@ -79,2 +83,2 @@

};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dpYy9zbWFydC13cml0ZS5qcyJdLCJuYW1lcyI6WyJhc3NlcnQiLCJyZXF1aXJlIiwiZnMiLCJwYXRoIiwiaXNFcXVhbCIsImNsb25lRGVlcCIsImZzRXh0cmEiLCJ5YW1sIiwic21hcnRSZWFkIiwieG1sUGFyc2VyIiwiZ2V0RXh0IiwibW9kdWxlIiwiZXhwb3J0cyIsImZpbGVwYXRoIiwiY29udGVudCIsIm9wdGlvbnMiLCJPYmplY3QiLCJBcnJheSIsImlzQXJyYXkiLCJjdHgiLCJhc3NpZ24iLCJtZXJnZVN0cmF0ZWd5IiwiZXhpc3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luYyhmaWxlcGF0aCwgY29udGVudFN0cmluZyk7XG4gICAgcmV0dXJuIHRydWU7XG4gIH1cbiAgcmV0dXJuIGZhbHNlO1xufTtcbiJdfQ==
{
"name": "smart-fs",
"version": "1.6.2",
"version": "1.7.0",
"description": "Abstraction Layer for File Management.",

@@ -44,4 +44,4 @@ "main": "lib/index.js",

"@babel/register": "7.4.0",
"@blackflux/eslint-plugin-rules": "1.0.2",
"@blackflux/robo-config-plugin": "1.7.3",
"@blackflux/eslint-plugin-rules": "1.0.4",
"@blackflux/robo-config-plugin": "1.7.4",
"babel-eslint": "10.0.1",

@@ -51,3 +51,3 @@ "chai": "4.2.0",

"eslint": "5.16.0",
"js-gardener": "2.0.6",
"js-gardener": "2.0.8",
"nyc": "14.0.0",

@@ -101,7 +101,8 @@ "semantic-release": "15.13.3",

"fs-extra": "7.0.1",
"json-stringify-pretty-compact": "2.0.0",
"lodash.clonedeep": "4.5.0",
"lodash.isequal": "4.5.0",
"xml-js": "1.6.11",
"yaml-boost": "1.9.1"
"yaml-boost": "1.9.2"
}
}

@@ -55,3 +55,3 @@ # smart-fs

### smartWrite(filepath. content, options = { treatAs = null, mergeStrategy = (existing, changeset) => changeset, create = true })
### smartWrite(filepath. content, options = { treatAs = null, mergeStrategy = (existing, changeset) => changeset, create = true, pretty = false })

@@ -79,4 +79,6 @@ Serialize and write content to file based on file extension.

When `pretty` is set to `true`, the output is formatted more compact.
## Important
Do not use this library for loading if you don't trust the source of the files you are loading!
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