Comments (3)
I would not consider this to be the responsibility of this library. It has nothing to do with the specifics of mongodb.
And a conversion function could be as simple as
function convert(obj) {
if (typeof obj !== "object") {
// "ignore" non object values
return obj
}
const keys = Object.keys(obj)
if (keys.length > 0) {
// copy all properties over while converting them
const clone = {}
for (const key of keys) {
clone[key] = convert(obj[key])
}
return clone
} else {
return 1
}
}
no guarantees, of course
from graphql-fields.
Yes I agree with @mormahr. You can easily check if it's a leaf node by using Object.keys
from graphql-fields.
Since there is no specific reason for end leafs to be empty object, it could be handful if possible. Anway I already stopped using this library, because of other problems related to mongodb. Thanks for your answers and time.
from graphql-fields.
Related Issues (20)
- Parsing arguments of nested fields HOT 4
- Please add CHANGELOG
- There is no support for aliased fields HOT 5
- Does not return Object type arguments HOT 4
- Port to TypeScript HOT 1
- Does not take variables in processed arguments into account HOT 1
- Doesn't acknowledge default argument values HOT 3
- Discussion: New API for this package HOT 6
- variables don't pass information of their kind
- Doesn't coerce single item to list
- if arguments = null not include
- Support graphql 15? HOT 4
- [FR] extract field extensions
- Examples with buildSchema
- (0 , graphql_fields_1.default) is not a function HOT 2
- How to incorporate this library when unit testing components
- Keep maintaining this library
- The example in the README is misleading HOT 2
- Compiled module breaks IE11 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-fields.