function* extractIdentifiersFromPattern(pattern) {
	switch (pattern.type) {
		case "Identifier":
			yield pattern;
			return;
		case "ObjectPattern":
			for (const property of pattern.properties) {
				yield* extractIdentifiersFromPattern(
					property.type === "Property" ? property.value : property,
				);
			}
			return;
		case "ArrayPattern":
			for (const element of pattern.elements) {
				if (!element) {
					continue;
				}
				yield* extractIdentifiersFromPattern(element);
			}
			return;
		case "RestElement":
			yield* extractIdentifiersFromPattern(pattern.argument);
			return;
		case "AssignmentPattern":
			yield* extractIdentifiersFromPattern(pattern.left);

		// no default
	}
}
Extract identifier from the given pattern node used on the left-hand side of the assignment.
@param {Pattern} pattern The pattern node to extract identifier
@returns {Iterable<Identifier>} The extracted identifier