MCPcopy Index your code
hub / github.com/totaljs/framework / parseSchema

Function parseSchema

graphdb.js:2415–2452  ·  view source on GitHub ↗
(schema)

Source from the content-addressed store, hash-verified

2413}
2414
2415function parseSchema(schema) {
2416
2417 var obj = {};
2418 var arr = schema.split('|').trim();
2419
2420 obj.meta = {};
2421 obj.keys = [];
2422 obj.raw = schema;
2423
2424 for (var i = 0; i < arr.length; i++) {
2425 var arg = arr[i].split(':');
2426 var type = 0;
2427 switch ((arg[1] || '').toLowerCase().trim()) {
2428 case 'number':
2429 type = 2;
2430 break;
2431 case 'boolean':
2432 case 'bool':
2433 type = 3;
2434 break;
2435 case 'date':
2436 type = 4;
2437 break;
2438 case 'object':
2439 type = 5;
2440 break;
2441 case 'string':
2442 default:
2443 type = 1;
2444 break;
2445 }
2446 var name = arg[0].trim();
2447 obj.meta[name] = { type: type, pos: i };
2448 obj.keys.push(name);
2449 }
2450
2451 return obj;
2452}
2453
2454function stringifyData(schema, doc) {
2455

Callers 1

graphdb.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected