'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var matcher = require('../matcher.js');

var filter = Array.prototype.filter;

function children() {
  return Array.from(this.children);
}

function childrenFilter(match) {
  return function() {
    return filter.call(this.children, match);
  };
}

function selection_selectChildren(match) {
  return this.selectAll(match == null ? children
      : childrenFilter(typeof match === "function" ? match : matcher.childMatcher(match)));
}

exports.default = selection_selectChildren;
