function size(x) {
  var s = [];

  while (Array.isArray(x)) {
    s.push(x.length);
    x = x[0];
  }

  return s;
}
Calculate the size of a multi dimensional array.
This function checks the size of the first entry, it does not validate
whether all dimensions match. (use function `validate` for that)
@param {Array} x
@Return {Number[]} size