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.

23 lines
333 B

  1. 'use strict';
  2. const arrify = value => {
  3. if (value === null || value === undefined) {
  4. return [];
  5. }
  6. if (Array.isArray(value)) {
  7. return value;
  8. }
  9. if (typeof value === 'string') {
  10. return [value];
  11. }
  12. if (typeof value[Symbol.iterator] === 'function') {
  13. return [...value];
  14. }
  15. return [value];
  16. };
  17. module.exports = arrify;