HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/elite/node_modules/googlemaps/lib/utils/parsePaths.js
var _encodePolyline = require('./encodePolylines');

/**
Transfors an array of paths into a pipe separeted string

input = [
  {
    points: [
      '40.737102,-73.990318',
      '40.749825,-73.987963',
      '40.752946,-73.987384',
      '40.755823,-73.986397'
    ],
    color: '0x0000ff',
    weight: 5
  }
]

output = color:0x0000ff|weight:5|40.737102,-73.990318|40.749825,-73.987963|40.752946,-73.987384|40.755823,-73.986397
**/
module.exports = function(paths, encodePolylines) {

  if (!Array.isArray(paths)) {
    throw new Error('paths must be an array');
  }

  return paths.map(function(path) {

    var i, len, p = [], keys = ['weight', 'color', 'fillcolor', 'geodisc'];

    for (i = 0, len = keys.length; i < len; i++) {
      if (path[keys[i]] != null) {
        p.push(keys[i] + ':' + path[keys[i]]);
      }
    }

    if (!Array.isArray(path.points)) {
      throw new Error('Each path must have an array of points');
    } else {
      if (encodePolylines === true) {
        p.push( 'enc:' + _encodePolyline(path['points']));
      } else {
        path['points'].map(function(point) {
          p.push(point);
        });
      }
    }

    return p.join('|');

  }).join('|');

}