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

ftconfig

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ftconfig - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

4

dist/index.d.ts

@@ -5,8 +5,8 @@ /// <reference types="node" />

import { WriteConfig } from "./WriteConfig";
export declare const read: <T = any>(data: string, options: string | IReadOptions) => WriteConfig<T>;
export declare const read: <T = any>(data: string, encodingOrOptions: string | IReadOptions) => WriteConfig<T>;
export declare const readFile: <T = any>(p: fs.PathLike, options?: IReadFileOptions) => WriteConfig<T>;
declare const _default: {
read: <T = any>(data: string, options: string | IReadOptions) => WriteConfig<T>;
read: <T = any>(data: string, encodingOrOptions: string | IReadOptions) => WriteConfig<T>;
readFile: <T_1 = any>(p: fs.PathLike, options?: IReadFileOptions) => WriteConfig<T_1>;
};
export default _default;

@@ -8,8 +8,12 @@ "use strict";

const WriteConfig_1 = require("./WriteConfig");
exports.read = (data, options) => {
if (typeof options === "string") {
const read = (data, encodingOrOptions) => {
let options;
if (typeof encodingOrOptions === "string") {
options = {
type: options
type: encodingOrOptions
};
}
else {
options = encodingOrOptions;
}
let adapter = adapters_1.getAdapter(options.type);

@@ -23,3 +27,4 @@ if (!adapter) {

};
exports.readFile = (p, options) => {
exports.read = read;
const readFile = (p, options = { type: "raw" }) => {
if (!fs.existsSync(p)) {

@@ -31,5 +36,2 @@ throw new Error(p.toString());

}
if (!options) {
options = {};
}
if (!options.type) {

@@ -52,2 +54,3 @@ options.type = "raw";

};
exports.readFile = readFile;
exports.default = { read: exports.read, readFile: exports.readFile };

@@ -8,12 +8,15 @@ import * as fs from "fs";

export const read = <T = any>(data: string, options: string | IReadOptions) => {
if (typeof options === "string") {
export const read = <T = any>(data: string, encodingOrOptions: string | IReadOptions) => {
let options: IReadOptions;
if (typeof encodingOrOptions === "string") {
options = {
type: options
type: encodingOrOptions
};
} else {
options = encodingOrOptions;
}
let adapter: IAdapter = getAdapter(options.type);
let adapter = getAdapter(options.type);
if (!adapter) {
options.type = "raw";
adapter = getAdapter(options.type);
adapter = getAdapter(options.type) as IAdapter;
}

@@ -24,3 +27,3 @@ const obj: T = adapter.parse(data);

export const readFile = <T = any>(p: fs.PathLike, options?: IReadFileOptions) => {
export const readFile = <T = any>(p: fs.PathLike, options: IReadFileOptions = { type: "raw" }) => {
if (!fs.existsSync(p)) {

@@ -32,5 +35,2 @@ throw new Error(p.toString());

}
if (!options) {
options = {} as any;
}
if (!options.type) {

@@ -37,0 +37,0 @@ options.type = "raw";

@@ -16,3 +16,3 @@ import * as fs from "fs";

this.options = options;
this.adapter = getAdapter(this.options.type);
this.adapter = getAdapter(this.options.type) as IAdapter;
}

@@ -50,3 +50,3 @@

public toString(options?) {
public toString(options?: any) {
return this.adapter.stringify(this.obj, options);

@@ -53,0 +53,0 @@ }

{
"name": "ftconfig",
"version": "1.1.3",
"version": "1.1.4",
"description": "F*ck the config",

@@ -77,3 +77,3 @@ "main": "dist/index.js",

"tslint": "^5.17.0",
"typescript": "^3.5.1"
"typescript": "^4.3.5"
},

@@ -80,0 +80,0 @@ "dependencies": {

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