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

@graphql-markdown/printer-legacy

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-markdown/printer-legacy - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

2

package.json

@@ -8,3 +8,3 @@ {

},
"version": "1.3.0",
"version": "1.3.1",
"license": "MIT",

@@ -11,0 +11,0 @@ "main": "src/index.js",

@@ -6,6 +6,10 @@ const {

const { MARKDOWN_EOL, DEPRECATED } = require("./const/strings");
const {
MARKDOWN_EOL,
DEPRECATED,
MARKDOWN_CODE_INDENTATION,
} = require("./const/strings");
const { OPTION_DEPRECATED } = require("./const/options");
const printCodeField = (type, options = {}) => {
const printCodeField = (type, options = {}, indentationLevel = 0) => {
const skipDirective =

@@ -23,3 +27,3 @@ hasProperty(options, "skipDocDirective") &&

let code = `${getTypeName(type)}`;
code += printCodeArguments(type);
code += printCodeArguments(type, indentationLevel + 1);
code += `: ${getTypeName(type.type)}`;

@@ -32,3 +36,3 @@ code += isDeprecated(type) ? ` @${DEPRECATED}` : "";

const printCodeArguments = (type) => {
const printCodeArguments = (type, indentationLevel = 1) => {
if (!hasProperty(type, "args") || type.args.length === 0) {

@@ -38,2 +42,5 @@ return "";

const argIndentation = MARKDOWN_CODE_INDENTATION.repeat(indentationLevel);
const parentIndentation =
indentationLevel === 1 ? "" : MARKDOWN_CODE_INDENTATION;
let code = `(${MARKDOWN_EOL}`;

@@ -47,5 +54,5 @@ code += type.args.reduce((r, v) => {

const propName = v.name.toString();
return `${r} ${propName}: ${propType}${printedDefault}${MARKDOWN_EOL}`;
return `${r}${argIndentation}${propName}: ${propType}${printedDefault}${MARKDOWN_EOL}`;
}, "");
code += `)`;
code += `${parentIndentation})`;

@@ -52,0 +59,0 @@ return code;

@@ -23,2 +23,3 @@ const ROOT_TYPE_LOCALE = {

const MARKDOWN_EOC = `${MARKDOWN_EOL}\`\`\`${MARKDOWN_EOL}`;
const MARKDOWN_CODE_INDENTATION = " ";
const FRONT_MATTER = "---";

@@ -38,4 +39,5 @@

MARKDOWN_EOC,
MARKDOWN_CODE_INDENTATION,
FRONT_MATTER,
DEPRECATED,
};

@@ -8,3 +8,3 @@ const {

const { printCodeField } = require("../code");
const { MARKDOWN_EOL } = require("../const/strings");
const { MARKDOWN_EOL, MARKDOWN_CODE_INDENTATION } = require("../const/strings");

@@ -42,4 +42,4 @@ const printInterfaceMetadata = (type, options) => {

.map((field) => {
const f = printCodeField(field, options);
return f.length > 0 ? ` ${f}` : "";
const f = printCodeField(field, options, 1);
return f.length > 0 ? `${MARKDOWN_CODE_INDENTATION}${f}` : "";
})

@@ -46,0 +46,0 @@ .filter((field) => field.length > 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