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.
 
 
 
 

38 lines
672 B

  1. function toVal(mix) {
  2. var k, y, str='';
  3. if (mix) {
  4. if (typeof mix === 'object') {
  5. if (Array.isArray(mix)) {
  6. for (k=0; k < mix.length; k++) {
  7. if (mix[k] && (y = toVal(mix[k]))) {
  8. str && (str += ' ');
  9. str += y;
  10. }
  11. }
  12. } else {
  13. for (k in mix) {
  14. if (mix[k] && (y = toVal(k))) {
  15. str && (str += ' ');
  16. str += y;
  17. }
  18. }
  19. }
  20. } else if (typeof mix !== 'boolean' && !mix.call) {
  21. str && (str += ' ');
  22. str += mix;
  23. }
  24. }
  25. return str;
  26. }
  27. export default function () {
  28. var i=0, x, str='';
  29. while (i < arguments.length) {
  30. if (x = toVal(arguments[i++])) {
  31. str && (str += ' ');
  32. str += x
  33. }
  34. }
  35. return str;
  36. }