@opentripplanner/core-utils
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -11,3 +11,2 @@ "use strict"; | ||
exports.summarizeQuery = summarizeQuery; | ||
exports.getUiUrlParams = getUiUrlParams; | ||
exports.getTripOptionsFromQuery = getTripOptionsFromQuery; | ||
@@ -27,4 +26,2 @@ exports.isNotDefaultQuery = isNotDefaultQuery; | ||
var _state = require("./state"); | ||
var _time = require("./time"); | ||
@@ -78,17 +75,3 @@ | ||
} | ||
/** | ||
* Assemble any UI-state properties to be tracked via URL into a single object | ||
* TODO: Expand to include additional UI properties | ||
*/ | ||
function getUiUrlParams(otpState) { | ||
const activeSearch = (0, _state.getActiveSearch)(otpState); | ||
const uiParams = { | ||
ui_activeItinerary: activeSearch ? activeSearch.activeItinerary : 0, | ||
ui_activeSearch: otpState.activeSearchId | ||
}; | ||
return uiParams; | ||
} | ||
function getTripOptionsFromQuery(query, keepPlace = false) { | ||
@@ -95,0 +78,0 @@ const options = { ...query |
118
lib/types.js
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.createChainableTypeChecker = createChainableTypeChecker; | ||
exports.latlngType = exports.transitIndexStopWithRoutes = exports.timeOptionsType = exports.itineraryType = exports.fareType = exports.legType = exports.stepsType = exports.encodedPolylineType = exports.configType = exports.languageConfigType = exports.transitOperatorType = void 0; | ||
exports.userLocationType = exports.geocodedFeatureType = exports.configuredCompanyType = exports.configuredModesType = exports.configuredModeType = exports.queryType = exports.modeSelectorOptionsType = exports.modeOptionType = exports.latlngType = exports.transitIndexStopWithRoutes = exports.timeOptionsType = exports.itineraryType = exports.fareType = exports.legType = exports.stepsType = exports.encodedPolylineType = exports.configType = exports.languageConfigType = exports.transitOperatorType = void 0; | ||
@@ -314,2 +314,116 @@ var _propTypes = _interopRequireDefault(require("prop-types")); | ||
}); | ||
exports.latlngType = latlngType; | ||
exports.latlngType = latlngType; | ||
const modeOptionType = _propTypes.default.shape({ | ||
id: _propTypes.default.string.isRequired, | ||
selected: _propTypes.default.bool, | ||
showTitle: _propTypes.default.bool, | ||
text: _propTypes.default.node.isRequired, | ||
title: _propTypes.default.string | ||
}); | ||
exports.modeOptionType = modeOptionType; | ||
const modeSelectorOptionsType = _propTypes.default.shape({ | ||
primary: modeOptionType, | ||
secondary: _propTypes.default.arrayOf(modeOptionType), | ||
tertiary: _propTypes.default.arrayOf(modeOptionType) | ||
}); | ||
exports.modeSelectorOptionsType = modeSelectorOptionsType; | ||
const queryType = _propTypes.default.shape({ | ||
from: _propTypes.default.string, | ||
to: _propTypes.default.string, | ||
date: _propTypes.default.string, | ||
time: _propTypes.default.string, | ||
departArrive: _propTypes.default.string, | ||
startTime: _propTypes.default.string, | ||
endTime: _propTypes.default.string, | ||
mode: _propTypes.default.string, | ||
showIntermediateStops: _propTypes.default.bool, | ||
maxWalkDistance: _propTypes.default.number, | ||
maxBikeDistance: _propTypes.default.number, | ||
optimize: _propTypes.default.string, | ||
optimizeBike: _propTypes.default.string, | ||
maxWalkTime: _propTypes.default.number, | ||
walkSpeed: _propTypes.default.number, | ||
maxBikeTime: _propTypes.default.number, | ||
bikeSpeed: _propTypes.default.number, | ||
maxEScooterDistance: _propTypes.default.number, | ||
watts: _propTypes.default.number, | ||
ignoreRealtimeUpdates: _propTypes.default.bool, | ||
companies: _propTypes.default.string, | ||
wheelchair: _propTypes.default.bool | ||
}); | ||
exports.queryType = queryType; | ||
const configuredModeType = _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({ | ||
mode: _propTypes.default.string.isRequired, | ||
label: _propTypes.default.string.isRequired, | ||
company: _propTypes.default.string | ||
})]); | ||
exports.configuredModeType = configuredModeType; | ||
const configuredModesType = _propTypes.default.shape({ | ||
transitModes: _propTypes.default.arrayOf(configuredModeType), | ||
accessModes: _propTypes.default.arrayOf(configuredModeType), | ||
exclusiveModes: _propTypes.default.arrayOf(configuredModeType), | ||
bicycleModes: _propTypes.default.arrayOf(configuredModeType), | ||
micromobilityModes: _propTypes.default.arrayOf(configuredModeType) | ||
}); | ||
exports.configuredModesType = configuredModesType; | ||
const configuredCompanyType = _propTypes.default.shape({ | ||
id: _propTypes.default.string.isRequired, | ||
label: _propTypes.default.string.isRequired, | ||
modes: _propTypes.default.string.isRequired | ||
}); | ||
/** | ||
* Depending on the geocoder that is used, more properties than just the `label` | ||
* property might be provided by the geocoder. For example, with the Pelias | ||
* geocoder, properties such as `id`, `layer`, `source` are also included. | ||
*/ | ||
exports.configuredCompanyType = configuredCompanyType; | ||
const geocodedFeatureType = _propTypes.default.shape({ | ||
geometry: _propTypes.default.shape({ | ||
coordinates: _propTypes.default.arrayOf(_propTypes.default.number.isRequired).isRequired, | ||
type: _propTypes.default.string.isRequired | ||
}).isRequired, | ||
properties: _propTypes.default.shape({ | ||
label: _propTypes.default.string.isRequired | ||
}).isRequired | ||
}); | ||
exports.geocodedFeatureType = geocodedFeatureType; | ||
const userLocationType = _propTypes.default.shape({ | ||
id: _propTypes.default.string, | ||
/** | ||
* Can be either 'home', 'work', or null | ||
*/ | ||
icon: _propTypes.default.string, | ||
lat: _propTypes.default.number.isRequired, | ||
lon: _propTypes.default.number.isRequired, | ||
name: _propTypes.default.string.isRequired, | ||
/** | ||
* This represents the last time that this location was selected in a | ||
* search | ||
*/ | ||
timestamp: _propTypes.default.number, | ||
/** | ||
* One of: 'home', 'work', 'stop' or 'recent' | ||
*/ | ||
type: _propTypes.default.string.isRequired | ||
}); | ||
exports.userLocationType = userLocationType; |
{ | ||
"name": "@opentripplanner/core-utils", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Core functionality that is shared among numerous UI components", | ||
@@ -14,2 +14,3 @@ "main": "lib/index.js", | ||
"bowser": "^2.7.0", | ||
"lodash.isequal": "^4.5.0", | ||
"moment": "^2.24.0", | ||
@@ -20,3 +21,3 @@ "moment-timezone": "^0.5.27", | ||
}, | ||
"gitHead": "50c63a274fae91f726276fe7a93b898d17791a1e" | ||
"gitHead": "0af1b7cda60bd4252b219dcf893e01c2acb2ed5d" | ||
} |
@@ -11,3 +11,2 @@ import qs from "qs"; | ||
import queryParams from "./query-params"; | ||
import { getActiveSearch } from "./state"; | ||
import { getCurrentTime, getCurrentDate } from "./time"; | ||
@@ -83,16 +82,2 @@ | ||
/** | ||
* Assemble any UI-state properties to be tracked via URL into a single object | ||
* TODO: Expand to include additional UI properties | ||
*/ | ||
export function getUiUrlParams(otpState) { | ||
const activeSearch = getActiveSearch(otpState); | ||
const uiParams = { | ||
ui_activeItinerary: activeSearch ? activeSearch.activeItinerary : 0, | ||
ui_activeSearch: otpState.activeSearchId | ||
}; | ||
return uiParams; | ||
} | ||
export function getTripOptionsFromQuery(query, keepPlace = false) { | ||
@@ -99,0 +84,0 @@ const options = { ...query }; |
@@ -279,1 +279,98 @@ import PropTypes from "prop-types"; | ||
}); | ||
export const modeOptionType = PropTypes.shape({ | ||
id: PropTypes.string.isRequired, | ||
selected: PropTypes.bool, | ||
showTitle: PropTypes.bool, | ||
text: PropTypes.node.isRequired, | ||
title: PropTypes.string | ||
}); | ||
export const modeSelectorOptionsType = PropTypes.shape({ | ||
primary: modeOptionType, | ||
secondary: PropTypes.arrayOf(modeOptionType), | ||
tertiary: PropTypes.arrayOf(modeOptionType) | ||
}); | ||
export const queryType = PropTypes.shape({ | ||
from: PropTypes.string, | ||
to: PropTypes.string, | ||
date: PropTypes.string, | ||
time: PropTypes.string, | ||
departArrive: PropTypes.string, | ||
startTime: PropTypes.string, | ||
endTime: PropTypes.string, | ||
mode: PropTypes.string, | ||
showIntermediateStops: PropTypes.bool, | ||
maxWalkDistance: PropTypes.number, | ||
maxBikeDistance: PropTypes.number, | ||
optimize: PropTypes.string, | ||
optimizeBike: PropTypes.string, | ||
maxWalkTime: PropTypes.number, | ||
walkSpeed: PropTypes.number, | ||
maxBikeTime: PropTypes.number, | ||
bikeSpeed: PropTypes.number, | ||
maxEScooterDistance: PropTypes.number, | ||
watts: PropTypes.number, | ||
ignoreRealtimeUpdates: PropTypes.bool, | ||
companies: PropTypes.string, | ||
wheelchair: PropTypes.bool | ||
}); | ||
export const configuredModeType = PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.shape({ | ||
mode: PropTypes.string.isRequired, | ||
label: PropTypes.string.isRequired, | ||
company: PropTypes.string | ||
}) | ||
]); | ||
export const configuredModesType = PropTypes.shape({ | ||
transitModes: PropTypes.arrayOf(configuredModeType), | ||
accessModes: PropTypes.arrayOf(configuredModeType), | ||
exclusiveModes: PropTypes.arrayOf(configuredModeType), | ||
bicycleModes: PropTypes.arrayOf(configuredModeType), | ||
micromobilityModes: PropTypes.arrayOf(configuredModeType) | ||
}); | ||
export const configuredCompanyType = PropTypes.shape({ | ||
id: PropTypes.string.isRequired, | ||
label: PropTypes.string.isRequired, | ||
modes: PropTypes.string.isRequired | ||
}); | ||
/** | ||
* Depending on the geocoder that is used, more properties than just the `label` | ||
* property might be provided by the geocoder. For example, with the Pelias | ||
* geocoder, properties such as `id`, `layer`, `source` are also included. | ||
*/ | ||
export const geocodedFeatureType = PropTypes.shape({ | ||
geometry: PropTypes.shape({ | ||
coordinates: PropTypes.arrayOf(PropTypes.number.isRequired).isRequired, | ||
type: PropTypes.string.isRequired | ||
}).isRequired, | ||
properties: PropTypes.shape({ | ||
label: PropTypes.string.isRequired | ||
}).isRequired | ||
}); | ||
export const userLocationType = PropTypes.shape({ | ||
id: PropTypes.string, | ||
/** | ||
* Can be either 'home', 'work', or null | ||
*/ | ||
icon: PropTypes.string, | ||
lat: PropTypes.number.isRequired, | ||
lon: PropTypes.number.isRequired, | ||
name: PropTypes.string.isRequired, | ||
/** | ||
* This represents the last time that this location was selected in a | ||
* search | ||
*/ | ||
timestamp: PropTypes.number, | ||
/** | ||
* One of: 'home', 'work', 'stop' or 'recent' | ||
*/ | ||
type: PropTypes.string.isRequired | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
145632
4280
8
+ Addedlodash.isequal@^4.5.0
+ Addedlodash.isequal@4.5.0(transitive)