routes-compressor
v1.1.1
Published
壓縮共線圖站點用工具
Downloads
2
Readme
routes-compressor
將共線圖用的站點資料壓縮的模組
usage
const compressor = require('routes-compressor');
const config = {
spaceChar: '-' // custom spaceChar, default is ''
}
const data = [
['stop1', 'stop2', 'stop3'],
['stop1', '-', 'stop3'],
['-', 'stop11', '-'],
['-', '-', 'stop4']
];
compressor(data, config).then((result) => {
console.log(result);
// output:
// [
// ['stop1', 'stop2', 'stop3'],
// ['stop1', '-', 'stop3'],
// ['stop11', '-', '-'],
// ['-', 'stop4', '-']
// ]
});
also allow input like:
const data = [
'a--b', // "-" 代表空白
'c-d-',
'c--f'.
'e--f'
]