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

@apollo/utils.printwithreducedwhitespace

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/utils.printwithreducedwhitespace - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

README.md

9

package.json
{
"name": "@apollo/utils.printwithreducedwhitespace",
"version": "1.1.0",
"version": "2.0.0",
"description": "Print an AST with as little whitespace as possible",

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

"url": "git+https://github.com/apollographql/apollo-utils.git",
"directory": "printWithReducedWhitespace/"
"directory": "packages/printWithReducedWhitespace/"
},

@@ -22,7 +22,4 @@ "keywords": [

"engines": {
"node": ">=12.13.0"
"node": ">=14"
},
"publishConfig": {
"access": "public"
},
"peerDependencies": {

@@ -29,0 +26,0 @@ "graphql": "14.x || 15.x || 16.x"

@@ -5,31 +5,25 @@ import gql from "graphql-tag";

describe("printWithReducedWhitespace", () => {
const cases = [
{
name: "lots of whitespace",
// Note: there's a tab after "tab->", which prettier wants to keep as a
// literal tab rather than \t. In the output, there should be a literal
// backslash-t.
input: gql`
query Foo($a: Int) {
user(
name: " tab-> yay"
other: """
apple
bag
cat
"""
) {
name
}
it("removes whitespace", () => {
// Note: there's a tab after "tab->", which prettier wants to keep as a
// literal tab rather than \t. In the output, there should be a literal
// backslash-t.
const document = gql`
query Foo($a: Int) {
user(
name: " tab-> yay"
other: """
apple
bag
cat
"""
) {
name
}
`,
output:
'query Foo($a:Int){user(name:" tab->\\tyay"other:"apple\\n bag\\ncat"){name}}',
},
];
cases.forEach(({ name, input, output }) => {
test(name, () => {
expect(printWithReducedWhitespace(input)).toEqual(output);
});
}
`;
expect(printWithReducedWhitespace(document)).toBe(
`query Foo($a:Int){user(name:" tab->\\tyay"other:"apple\\n bag\\ncat"){name}}`,
);
});
});
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