Package Exports
- objectify
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (objectify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Objectify
Objectify recurses over a directory reading all text files that match a given set of extensions. It builds an object tree that matches the directory's structure into an object.
npm install objectifyUsage
Assuming the following directory structure:
templates
admin
dashboard.html
blog
post
create.html
show.html
edit.html
comment
create.html
show.html
edit.htmlThen calling:
var objectify = require('objectify');
var result = objectify.get('./templates', { extensions: ['html'] });Would populate the result variable with an object like so:
{
admin: {
dashboard: '' // populated with the contents of ./templates/admin/dashboard.html
},
blog: {
post: {
create: '', // populated with the contents of ./templates/post/create.html
show: '', // populated with the contents of ./templates/post/show.html
edit: '', // populated with the contents of ./templates/post/edit.html
},
comment: {
create: '', // populated with the contents of ./templates/comment/create.html
show: '', // populated with the contents of ./templates/comment/show.html
edit: '', // populated with the contents of ./templates/comment/edit.html
}
}
}