Commit 4c3487f1 by Wee

refactor: remove `__DEV__` temporary

parent 54e2502e
{ {
"name": "react-live-route", "name": "react-live-route",
"version": "3.0.3", "version": "3.0.4",
"description": "A living route for react-router v4", "description": "A living route for react-router v4",
"repository": "fi3ework/react-live-route", "repository": "fi3ework/react-live-route",
"license": "MIT", "license": "MIT",
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"scripts": { "scripts": {
"build": "rm -fr dist && tsc", "build": "rm -fr dist && tsc",
"dev": "tsc -b -w --pretty", "dev": "tsc -b -w --pretty",
"prepublishOnly": "npm run build", "prepublishOnly": "yarn run build",
"lint": "tslint src", "lint": "tslint src",
"test": "jest --coverage", "test": "jest --coverage",
"test:watch": "jest --watch" "test:watch": "jest --watch"
......
// import pathToRegexp from 'path-to-regexp'
// const cache = {}
// const cacheLimit = 10000
// let cacheCount = 0
// function compilePath(path, options) {
// const cacheKey = `${options.end}${options.strict}${options.sensitive}`
// const pathCache = cache[cacheKey] || (cache[cacheKey] = {})
// if (pathCache[path]) return pathCache[path]
// const keys = []
// const regexp = pathToRegexp(path, keys, options)
// const result = { regexp, keys }
// if (cacheCount < cacheLimit) {
// pathCache[path] = result
// cacheCount++
// }
// return result
// }
// /**
// * Public API for matching a URL pathname to a path.
// */
// function matchPath(pathname, options = {}) {
// if (typeof options === 'string') options = { path: options }
// const { path, exact = false, strict = false, sensitive = false } = options
// const paths = [].concat(path)
// return paths.reduce((matched, path) => {
// if (matched) return matched
// const { regexp, keys } = compilePath(path, {
// end: exact,
// strict,
// sensitive
// })
// const match = regexp.exec(pathname)
// if (!match) return null
// const [url, ...values] = match
// const isExact = pathname === url
// if (exact && !isExact) return null
// return {
// path, // the path used to match
// url: path === '/' && url === '' ? '/' : url, // the matched portion of the URL
// isExact, // whether or not we matched exactly
// params: keys.reduce((memo, key, index) => {
// memo[key.name] = values[index]
// return memo
// }, {})
// }
// }, null)
// }
// export default matchPath
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment