indutny/asn1.js — pull request #17 by muromec (2014-08-07 19:59:31+00:00)
Title: Use function

Add a way to change submodels on the fly, by passing routing function to use().

Usage example:

```javascript
var ContenModels = {
signedData: SignedData,
envelopedData: EnvelopedData
};

var ContentInfo = asn1.define('ContentInfo', function() {
this.seq().obj(
this.key('contentType').objid(PKCS7_CONTENT_TYPES),
this.key('content').optional().explicit(0).use(function () {
return ContenModels[this.contentType];
})
);
});
```