Skip to content

Zolmeister/metaz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Metaz js

Node.js Metaprogramming library

npm install metaz

// library.js
'use strict'
var metaz = require('metaz')

// Invalidate require cache on each require to get the parent again
delete require.cache[__filename]

var meta = metaz.getExports(module.parent, metaz.getSource(module.parent), './metalib')

// Do anything you want with the source,
// e.g. parse the AST for interesting content
var source = metaz.getSource(module.parent)

meta.source = function() {
  return source
}

meta.addOne = function() {
  return 100
}

// Overrides the module with your new exports
metaz.modifyExports(module.parent, meta)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages