title: How to get buffer type in vimscript
body: <p>How can I get the buffer type of a buffer given its buffer id? I know I can switch to that buffer and use <code>:set buftype?</code> to get the type.</p>
  
  <p>But how can I do it without jumping to that buffer? </p>
  
  <p>(I would expect to have something like <code>buftype(id)</code> working similarly to <code>bufname(id)</code>)</p>