notes + docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-05-22 14:23:21 +03:00
parent e9fa52f550
commit 79bf5fed4c

View File

@ -301,10 +301,12 @@ module.BaseStore = {
// .match(<pattern>) // .match(<pattern>)
// .match(<pattern>, false) // .match(<pattern>, false)
// -> [<path>, ...] // -> [<path>, ...]
// -> []
// //
// Match pages (paths in strict mode) // Match pages (paths in strict mode)
// .match(<pattern>, true) // .match(<pattern>, true)
// -> [<path>, ...] // -> [<path>, ...]
// -> []
// //
// In strict mode the trailing star in the pattern will only match // In strict mode the trailing star in the pattern will only match
// actual existing pages, while in non-strict mode the pattern will // actual existing pages, while in non-strict mode the pattern will
@ -346,9 +348,19 @@ module.BaseStore = {
p = this.exists(p) p = this.exists(p)
if(p){ if(p){
return p } } }, return p } } },
// XXX like .match(..) when paths end in '/' but when paths end with //
// a non-pattern then match the basedir and then add the basename // .resolve(<path>)
// to each resulting path... // -> <path>
//
// .resolve(<pattern>)
// -> [<path>, ...]
// -> []
//
// This is like .match(..) for non-pattern paths and paths ending
// with '/'; When patterns end with a non-pattern then match the
// basedir and add the basename to each resulting path...
//
// XXX should this be used by .get(..) instead of .match(..)???
// XXX EXPERIMENTAL // XXX EXPERIMENTAL
resolve: function(path){ resolve: function(path){
// pattern match * / ** // pattern match * / **
@ -362,11 +374,11 @@ module.BaseStore = {
&& !name.includes('*')){ && !name.includes('*')){
path.pop() path.pop()
path.push('') path.push('')
return this.match(path.join('/'), false) return this.match(path.join('/'), true)
.map(function(p){ .map(function(p){
return module.path.join(p, name) }) } } return module.path.join(p, name) }) } }
// direct... // direct...
return this.match(path, false) }, return this.match(path) },
// //
// Resolve page // Resolve page
// .get(<path>) // .get(<path>)