How to use the tstl.PriorityQueue function in tstl

To help you get started, we’ve selected a few tstl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github valoryteam / valory / src / compiler / preprocessor.ts View on Github external
export function schemaPreprocess(schema: ExtendedSchema):
{schema: ExtendedSchema, resQueue: PriorityQueue} {
	const schemaClone = cloneDeep(schema);
	const anyOfQueue = new PriorityQueue((a, b): boolean => (a.depth > b.depth));

	const deepScan = (scanSchema: ExtendedSchema, depth: number = 0) => {
		if (scanSchema.required) {
			scanSchema.required.forEach((item) => {
				if (scanSchema.properties[item].readOnly) {
					throw Error(`Readonly property "${item}" marked as required`);
				}
			});
		}

		if (scanSchema.properties) {
			forEach(scanSchema.properties, (schemaChild) => {
				deepScan(schemaChild, depth + 1);
			});
		}