code: function path2contours(path) {
  
          if (!path || !path.length) {
              return null;
          }
  
          path = path.trim();
  
          // 修正头部不为`m`的情况
          if (path[0] !== 'M' && path[0] !== 'm') {
              path = 'M 0 0' + path;
          }
  
          // 修复中间没有结束符`z`的情况
          path = path.replace(/(\d+)\s*(m|$)/gi, '$1z$2');
  
          // 获取segments
          var segments = [];
          var cmd;
          var relative = false;
          var lastIndex;
          var args;
  
          for (var i = 0, l = path.length; i < l; i++) {
              var c = path[i].toUpperCase();
              var r = c !== path[i];
  
              switch (c) {
                  case 'M':
                      /*jshint -W086 */
                      if (i === 0) {
                          cmd = c;
                          lastIndex = 1;
                          break;
                      }
                  case 'Q':
                  case 'T':
                  case 'C':
                  case 'S':
                  case 'H':
                  case 'V':
                  case 'L':
                  case 'A':
                  case 'Z':
                      if (cmd === 'Z') {
                          segments.push({cmd: 'Z'});
                      }
                      else {
                          args = path.slice(lastIndex, i);
                          segments.push({
                              cmd: cmd,
                              relative: relative,
                              args: parseParams(args)
                          });
                      }
  
                      cmd = c;
                      relative = r;
                      lastIndex = i + 1;
                      break;
  
              }
          }
  
          segments.push({cmd: 'Z'});
  
          return segments2Contours(segments);
      }
docs: svg path转轮廓
  
  @param {string} path svg的path字符串
  @return {Array} 转换后的轮廓