✨ MAJOR FEATURES: • Auto-zoom intelligence với smart bounds fitting • Enhanced 3D GPS markers với pulsing effects • Professional route display với 6-layer rendering • Status-based parking icons với availability indicators • Production-ready build optimizations 🗺️ AUTO-ZOOM FEATURES: • Smart bounds fitting cho GPS + selected parking • Adaptive padding (50px) cho visual balance • Max zoom control (level 16) để tránh quá gần • Dynamic centering khi không có selection 🎨 ENHANCED VISUALS: • 3D GPS marker với multi-layer pulse effects • Advanced parking icons với status colors • Selection highlighting với animation • Dimming system cho non-selected items 🛣️ ROUTE SYSTEM: • OpenRouteService API integration • Multi-layer route rendering (glow, shadow, main, animated) • Real-time distance & duration calculation • Visual route info trong popup 📱 PRODUCTION READY: • SSR safe với dynamic imports • Build errors resolved • Global deployment via Vercel • Optimized performance 🌍 DEPLOYMENT: • Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app • Bundle size: 22.8 kB optimized • Global CDN distribution • HTTPS enabled 💾 VERSION CONTROL: • MapView-v2.0.tsx backup created • MAPVIEW_VERSIONS.md documentation • Full version history tracking
106 lines
2.1 KiB
JavaScript
106 lines
2.1 KiB
JavaScript
import _formatNumber from '../format.js'
|
|
import parse from '../parse.js'
|
|
import isObject from '../helpers/isObject.js'
|
|
|
|
export default function formatNumber() {
|
|
const {
|
|
input,
|
|
format,
|
|
options,
|
|
metadata
|
|
} = normalizeArguments(arguments)
|
|
|
|
return _formatNumber(input, format, options, metadata)
|
|
}
|
|
|
|
// Sort out arguments
|
|
function normalizeArguments(args)
|
|
{
|
|
const [arg_1, arg_2, arg_3, arg_4, arg_5] = Array.prototype.slice.call(args)
|
|
|
|
let input
|
|
let format
|
|
let options
|
|
let metadata
|
|
|
|
// Sort out arguments.
|
|
|
|
// If the phone number is passed as a string.
|
|
// `format('8005553535', ...)`.
|
|
if (typeof arg_1 === 'string')
|
|
{
|
|
// If country code is supplied.
|
|
// `format('8005553535', 'RU', 'NATIONAL', [options], metadata)`.
|
|
if (typeof arg_3 === 'string')
|
|
{
|
|
format = arg_3
|
|
|
|
if (arg_5)
|
|
{
|
|
options = arg_4
|
|
metadata = arg_5
|
|
}
|
|
else
|
|
{
|
|
metadata = arg_4
|
|
}
|
|
|
|
input = parse(arg_1, { defaultCountry: arg_2, extended: true }, metadata)
|
|
}
|
|
// Just an international phone number is supplied
|
|
// `format('+78005553535', 'NATIONAL', [options], metadata)`.
|
|
else
|
|
{
|
|
if (typeof arg_2 !== 'string')
|
|
{
|
|
throw new Error('`format` argument not passed to `formatNumber(number, format)`')
|
|
}
|
|
|
|
format = arg_2
|
|
|
|
if (arg_4)
|
|
{
|
|
options = arg_3
|
|
metadata = arg_4
|
|
}
|
|
else
|
|
{
|
|
metadata = arg_3
|
|
}
|
|
|
|
input = parse(arg_1, { extended: true }, metadata)
|
|
}
|
|
}
|
|
// If the phone number is passed as a parsed number object.
|
|
// `format({ phone: '8005553535', country: 'RU' }, 'NATIONAL', [options], metadata)`.
|
|
else if (isObject(arg_1))
|
|
{
|
|
input = arg_1
|
|
format = arg_2
|
|
|
|
if (arg_4)
|
|
{
|
|
options = arg_3
|
|
metadata = arg_4
|
|
}
|
|
else
|
|
{
|
|
metadata = arg_3
|
|
}
|
|
}
|
|
else throw new TypeError('A phone number must either be a string or an object of shape { phone, [country] }.')
|
|
|
|
// Legacy lowercase formats.
|
|
if (format === 'International') {
|
|
format = 'INTERNATIONAL'
|
|
} else if (format === 'National') {
|
|
format = 'NATIONAL'
|
|
}
|
|
|
|
return {
|
|
input,
|
|
format,
|
|
options,
|
|
metadata
|
|
}
|
|
} |