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.9.14 to 1.10.0

14

lib/logic/smart-read.js

@@ -11,4 +11,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

const yaml = require('yaml-boost');
const yamlBoost = require('yaml-boost');
const yaml = require('js-yaml');
const xmlParser = require('../util/xml-parser');

@@ -23,7 +25,9 @@

const ctx = _objectSpread({
treatAs: null
treatAs: null,
resolve: true
}, options);
assert(Object.keys(ctx).length === 1, 'Unexpected Option provided!');
assert(Object.keys(ctx).length === 2, 'Unexpected Option provided!');
assert(ctx.treatAs === null || typeof ctx.treatAs === 'string');
assert(typeof ctx.resolve === 'boolean');
let result;

@@ -42,3 +46,3 @@

case 'yaml':
result = yaml.load(filepath, {});
result = ctx.resolve ? yamlBoost.load(filepath, {}) : yaml.load(fs.readFileSync(filepath, 'utf8'));
break;

@@ -63,2 +67,2 @@

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

@@ -46,8 +46,8 @@ "main": "lib/index.js",

"devDependencies": {
"@babel/cli": "7.6.0",
"@babel/core": "7.6.0",
"@babel/plugin-proposal-object-rest-spread": "7.5.5",
"@babel/register": "7.6.0",
"@blackflux/eslint-plugin-rules": "1.3.10",
"@blackflux/robo-config-plugin": "2.6.7",
"@babel/cli": "7.6.2",
"@babel/core": "7.6.2",
"@babel/plugin-proposal-object-rest-spread": "7.6.2",
"@babel/register": "7.6.2",
"@blackflux/eslint-plugin-rules": "1.3.12",
"@blackflux/robo-config-plugin": "2.6.13",
"babel-eslint": "10.0.3",

@@ -62,4 +62,4 @@ "chai": "4.2.0",

"eslint-plugin-mocha": "6.1.1",
"js-gardener": "2.0.89",
"node-tdd": "2.5.5",
"js-gardener": "2.0.102",
"node-tdd": "2.5.12",
"nyc": "14.1.1",

@@ -112,2 +112,3 @@ "semantic-release": "15.13.24"

"fs-extra": "8.1.0",
"js-yaml": "3.13.1",
"json-stringify-pretty-compact": "2.0.0",

@@ -114,0 +115,0 @@ "lodash.clonedeep": "4.5.0",

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

### smartRead(filepath, options = { treatAs = null })
### smartRead(filepath, options = { treatAs = null, resolve = true })

@@ -58,2 +58,4 @@ Read and parse file based on file extension.

To simply load yml files without resolving them pass `resolve` as `false`
### smartWrite(filepath. content, options = { treatAs = null, mergeStrategy = (existing, changeset) => changeset, create = true, pretty = false, keepOrder = true })

@@ -60,0 +62,0 @@

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