UNPKG

@pothos/core

Version:

Pothos (formerly GiraphQL) is a plugin based schema builder for creating code-first GraphQL schemas in typescript

42 lines (41 loc) 919 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _export(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get }); } _export(exports, { get classDepth () { return classDepth; }, get sortClasses () { return sortClasses; } }); function classDepth(obj) { const proto = Object.getPrototypeOf(obj); if (!proto) { return 0; } return 1 + classDepth(proto); } function sortClasses(classes) { return [ ...classes ].sort((a, b)=>{ const depthA = classDepth(a); const depthB = classDepth(b); if (depthA > depthB) { return -1; } if (depthB > depthA) { return 1; } return 0; }); } //# sourceMappingURL=sort-classes.js.map