gql-json-slicer
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

gql like JSON slicer

Usage:

const gqlSlice = require('gql-json-slicer');


const data = {
  user: {
    id: 1000,
    logo: "JohnLogo.jpg",
    name: "John Smith",
    projects: [
      {
        name: "Star Wars",
        type: "Movie"
      },
      {
        name: "Wookie",
        type: "Character"
      }
    ]
  }

}

gqlSlice(`{
  user {
    name
    projects {
      name
    }
  }
}`, data);

/* result:
{
  user: {
    name: "John Smith",
    projects: [
      {name: "Star Wars"},
      {name: "Wookie"}
    ]
  }
}
*/

Readme

Keywords

none

Package Sidebar

Install

npm i gql-json-slicer

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

10.6 kB

Total Files

8

Last publish

Collaborators

  • edjafarov