0.0.12 • Published 2 years ago

implicit-association-test v0.0.12

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Auto-genereated API docs

https://jroitgrund.github.io/iat

Installation

npm install implicit-association-test

Usage

import { getResults, IAT, Item } from "implicit-association-test";

type TargetT = "insects" | "flowers";
type CategoryT = "pleasant" | "unpleasant";

const targets: Record<TargetT, Item[]> = {
  insects: [
    { type: "text", text: "wasp" },
    { type: "text", text: "bee" },
    { type: "text", text: "ant" },
  ],
  flowers: [
    { type: "text", text: "rose" },
    { type: "text", text: "tulip" },
    { type: "text", text: "daffodil" },
  ],
};

const categories: Record<CategoryT, Item[]> = {
  pleasant: [
    { type: "text", text: "nice" },
    { type: "text", text: "soft" },
    { type: "text", text: "lush" },
  ],
  unpleasant: [
    { type: "text", text: "horrible" },
    { type: "text", text: "repulsive" },
    { type: "text", text: "scary" },
  ],
};

const iatStage = IAT({
  categories,
  targets,
  trialsPerBlock: {
    1: 3,
    2: 3,
    3: 3,
    4: 3,
    5: 3,
    6: 3,
    7: 3,
  },
});

while (!iatStage.testComplete) {
  iatStage.block; // 1-7;
  iatStage.trial; // 1-n, configured in options;
  iatStage.item; // item to display, image or text
  iatStage.left; // category and / or target to display on the left
  iatStage.right; // category and / or target to display on the right
  iatStage.correctChoice; // "left" or "right": the correct item assignment

  iatStage = iatStage.next(completionTimeMs, didUserMakeCorrectChoice);
}

iatStage.rawResults; // completion times and correctness for each trial
const results = getResults(iatStage.rawResults); // d-score + which association was preferred
0.0.12

2 years ago

0.0.11

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago