restructuring the project

This commit is contained in:
Kevin Jahns
2019-03-01 23:26:40 +01:00
parent f6b4819ae3
commit 75f4a0a5f0
163 changed files with 6423 additions and 10770 deletions

26
src/utils/isParentOf.js Normal file
View File

@@ -0,0 +1,26 @@
/**
* @module utils
*/
import { Y } from '../utils/Y.js' // eslint-disable-line
import { Type } from '../structs/Type.js' // eslint-disable-line
/**
* Check if `parent` is a parent of `child`.
*
* @param {Type | Y} parent
* @param {Type | Y} child
* @return {Boolean} Whether `parent` is a parent of `child`.
*
* @public
*/
export const isParentOf = (parent, child) => {
child = child._parent
while (child !== null) {
if (child === parent) {
return true
}
child = child._parent
}
return false
}