web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
370 B

  1. 'use strict';
  2. const internals = {};
  3. module.exports = internals.flatten = function (array, target) {
  4. const result = target || [];
  5. for (let i = 0; i < array.length; ++i) {
  6. if (Array.isArray(array[i])) {
  7. internals.flatten(array[i], result);
  8. }
  9. else {
  10. result.push(array[i]);
  11. }
  12. }
  13. return result;
  14. };