<commit_before>import {map} from "ramda"
import {isPopulated} from "ramda-extra"

import resource from "./resource"

type ResourceType = {
  id: string,
  attributes: {
    intent: string,
    version: string,
    namespace: string,
    verb: string,
    href: string,
    mediatype: string,
  },
}

type ResourceModelType = {
  id: string,
  intent: string,
  version: string,
  namespace: string,
  verb: string,
  href: string,
  mediatype: string,
  request: Function,
}

export default function wrapResources (resources: Array<ResourceType>): Array<ResourceModelType> {
  if (isPopulated(resources)) {
    return map(resource, resources)
  }

  throw new Error("hsdk recieved an invalid response payload, check the home network request")
}<commit_msg>Just in case the mocks are wrong<commit_after>import {map} from "ramda"
import {type} from "ramda"
import {isNil} from "ramda"
import {isPopulated} from "ramda-extra"

import resource from "./resource"

type ResourceType = {
  id: string,
  attributes: {
    intent: string,
    version: string,
    namespace: string,
    verb: string,
    href: string,
    mediatype: string,
  },
}

type ResourceModelType = {
  id: string,
  intent: string,
  version: string,
  namespace: string,
  verb: string,
  href: string,
  mediatype: string,
  request: Function,
}

export default function wrapResources (resources: Array<ResourceType>): Array<ResourceModelType> {
  if (isNil(resources)) {
    throw new Error(`Resources was ${type(resources)} and not an Array`)
  }

  if (isPopulated(resources)) {
    return map(resource, resources)
  }

  throw new Error("hsdk recieved an invalid response payload, check the home network request")
}
{'fraction_non_alphanumeric': 0.10828402366863905, 'fraction_numerical': 0.0, 'mean_word_length': 4.108761329305136, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3195738', 'n_tokens_mistral': 523, 'n_tokens_neox': 510, 'n_words': 169}