@advertima/snapshot

[![Build Status](https://travis-ci.org/advertima/snapshot.svg?branch=development)](https://travis-ci.org/advertima/snapshot) [![npm version](https://badge.fury.io/js/%40advertima%2Fsnapshot.svg)](https://badge.fury.io/js/%40advertima%2Fsnapshot) [![codeco

Usage no npm install needed!

<script type="module">
  import advertimaSnapshot from 'https://cdn.skypack.dev/@advertima/snapshot';
</script>

README

snapshot

Build Status npm version codecov Minfied size Minified + gzip size

POISnapshot models Javascript utilities to decode to a POISnapshot

Installation

$ npm install @advertima/snapshot --save

The @advertima/snapshot type definitions are included in the npm package.

Basics

import { POISnapshot } from '@advertima/snapshot';

// Decode binary snapshot
const snapshot = POISnapshot.decode(someBinaryData);

Test Utils

We provide you an easy way to create a POISnapshot instance of a PersonDetection instance for your tests.

import {
  PersonDetectionGenerator,
  POISnapshotGenerator,
  ContentMessageGenerator,
} from '@advertima/snapshot';

const person = PersonDetectionGenerator.generate({ age: 27, gender: 'male', y: 1.4 });

const params1 = { age: 27, gender: 'female', name: 'toto' };
const params2 = { age: 28, gender: 'male', name: 'titi' };
const snapshot = POISnapshotGenerator.generate([params1, params2]);

const contentMessage = ContentMessageGenerator.generate({
  localTimestamp: 1537362300000,
  contentId: '1',
  name: 'start',
  personPutIds: [],
  poi: 1,
});

License

@advertima/snapshot is MIT licensed.