![New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions](https://cdn.sanity.io/images/cgdhsj6q/production/86e6ebdea652d20da070ebbda20134b839972db7-1024x1024.webp?w=800&fit=max&auto=format)
Security News
New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
cherrytreex
Advanced tools
Readme
Cherrytree is a flexible hierarchical router that translates every URL change into a transition descriptor object and calls your middleware functions that put the application into a desired state.
This is a fork of master / v2 branch with the following changes
The size excluding path-to-regexp dependency is ~43kB (without minification and compression)
$ npm install --save cherrytreex
In a CJS/AMD environment
require('cherrytreex')
See it in action in this demo.
To use cherrytree
with React, check out cherrytree-for-react
.
var Cherrytree = require('cherrytreex')
// create the router
var router = new Cherrytree()
var handlers = require('./handlers')
// provide your route map
router.map(function (route) {
route('application', {path: '/', abstract: true}, function () {
route('feed', {path: ''})
route('messages')
route('status', {path: ':user/status/:id'})
route('profile', {path: ':user'}, function () {
route('profile.lists')
route('profile.edit')
})
})
})
router.use(function render (transition) {
transition.routes.forEach(function (route, i) {
route.view = handlers[route.name]({
params: transition.params,
query: transition.query
})
var parent = transition.routes[i-1]
var containerEl = parent ? parent.view.el.querySelector('.outlet') : document.body
containerEl.appendChild(view.render().el)
})
})
// for error logging attach a catch handler to transition promise...
router.use(function errorHandler (transition) {
transition.catch(function (err) {
if (err.type !== 'TransitionCancelled' && err.type !== 'TransitionRedirected') {
console.error(err.stack)
}
})
})
// ...or use the error hook
router.use({
error: function (transition, err) {
if (err.type !== 'TransitionCancelled' && err.type !== 'TransitionRedirected') {
console.error(err.stack)
}
}
})
// start listening to URL changes
router.listen()
You can clone this repo if you want to run the examples
locally:
A more complex example in it's own repo:
router.generate('commit', {sha: '1e2760'})
#
as appropriaterouter.transitionTo('commits')
cherrytree
you'll have to write the glue code for integrating into React yourself (see cherrytree-for-react
plugin). However, what you get instead is a smaller, simpler and hopefully more flexible library which should be more adaptable to your specific needs. This also means that you can use a react-router
like approach with other React
inspired libraries such as mercury
, riot
, om
, cycle
, deku
and so on.Cherrytree works in all modern browsers. It requires es5 environment and es6 promises. Use polyfills for those if you have to support older browsers, e.g.:
Thanks to Marko Stupić for giving Cherrytree a logo from his http://icon-a-day.com/ project!
cherrytree
written as one word? You got me, I'd say that represents the wabisabi nature of the library.This project was created by the Engineering team at Qubit. As we use open source libraries, we make our projects public where possible.
We’re currently looking to grow our team, so if you’re a JavaScript engineer and keen on ES2016 React+Redux applications and Node micro services, why not get in touch? Work with like minded engineers in an environment that has fantastic perks, including an annual ski trip, yoga, a competitive foosball league, and copious amounts of yogurt.
Find more details on our Engineering site. Don’t have an up to date CV? Just link us your Github profile! Better yet, send us a pull request that improves this project.
FAQs
Cherrytree - a flexible hierarchical client side router
The npm package cherrytreex receives a total of 15 weekly downloads. As such, cherrytreex popularity was classified as not popular.
We found that cherrytreex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
Security News
Results from the 2023 State of JavaScript Survey highlight key trends, including Vite's dominance, rising TypeScript adoption, and the enduring popularity of React. Discover more insights on developer preferences and technology usage.
Security News
The US Justice Department has penalized two consulting firms $11.3 million for failing to meet cybersecurity requirements on federally funded projects, emphasizing strict enforcement to protect sensitive government data.