Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 4x 4x 4x 4x 24x 24x 36x 11x 25x 24x | import { getCommonSchema } from './get-common-schema'; /** * The filter function used in natural join. * It generates a function that will have the logic to join two * DataModel instances by the process of natural join. * * @param {DataModel} dm1 - The left DataModel instance. * @param {DataModel} dm2 - The right DataModel instance. * @return {Function} Returns a function that is used in cross-product operation. */ export function naturalJoinFilter (dm1, dm2) { const dm1FieldStore = dm1.getFieldspace(); const dm2FieldStore = dm2.getFieldspace(); // const dm1FieldStoreName = dm1FieldStore.name; // const dm2FieldStoreName = dm2FieldStore.name; const commonSchemaArr = getCommonSchema(dm1FieldStore, dm2FieldStore); return (dm1Fields, dm2Fields) => { let retainTuple = true; commonSchemaArr.forEach((fieldName) => { if (dm1Fields[fieldName].value === dm2Fields[fieldName].value && retainTuple) { retainTuple = true; } else { retainTuple = false; } }); return retainTuple; }; } |