versioning for object function arguments
Sometimes a it is nice to know which version of data a function is passed. Especially in NoSQL land it can be used to ensure some kind of schema, and handle changes transparently.
Todo this Depreciator assumes that the data contains a numeric version under the key __version
__version: 1 something: 'else' can: 'be here'
This version is checked against the ensured, and actions can be take for it. No version present assumes a 0.
For depreciator to hook the functions it need to be required and enabled for a given module
var depreciator = require'depreciator'var myThing =doGreatThingsthing param stuffdoAwesomeStuffthing stuffmoduleexports = depreciatorenablemyThing
Now versions can be ensured on the functions, it will check the first argument to the function for it's __version field.
ensure version for just this function
ensure version globally for every function in the module it is enabled for.
ensure version for just this function and call fallback if versions don't match
versionensure3 'func'console.log"you are old"
install a global fallback function to be called on version missmatch
register hook for when versions are not satisfied hooks are run before the function is called