/** Returns the _positive_ modulus */
export function posMod (n, m) {
  return (n % m + m) % m
}

export function getAttributes (object, keys) {
  const output = {}
  keys.forEach(key => {
    if (object.hasOwnProperty(key)) {
      output[key] = object[key]
    } else {
      throw Error(`object has no attribute ${key}`)
    }
  })
  return output
}

export function objectMap (object, map) {
  const out = {}
  Object.entries(object).forEach(([attribute, value]) => {
    out[attribute] = map(value)
  })
  return out
}

@@ -90,16 +90,378 @@
 ) %25 m%0A%7D%0A
+/**%0A * Return copy of object that contains only the attributes specified in key array %0A * %0A * @param %7BObject%7D object Object that attributes are copied from%0A * @param %7BString%5B%5D%7D keys String array of attributes to copy%0A * @throws %7BError%7D Object does not contain attribute key%0A * @returns %7BObject%7D Object that contains only the attributes specified in key array%0A */
 %0Aexport 

Add JSdoc for getAttributes