nl_tokens: find the primary version ; ensure we don t have more than one
pl_tokens: function _getPrimaryVersion ( metadata ) { var primaryVersion = null ; for ( var i = 0 ; i < metadata . <mask> . length ; i ++ ) { if ( metadata . versions [ i ] . status == STATUS_PRIMARY ) { if ( primaryVersion !== null ) { throw new Error ( 'Invalid key: multiple primary keys' ) ; } primaryVersion = metadata . versions [ i ] . versionNumber ; } } if ( primaryVersion === null ) { throw new Error ( 'No primary key' ) ; } return primaryVersion ; }