UNPKG

@ricepuddin/redux-segment

Version:

Segment.io analytics integration for redux.

29 lines (22 loc) 625 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); function getIdentifyProperties(fields) { if (!fields.userId) return ['traits', 'options']; return ['userId', 'traits', 'options']; } function extractFields(obj, keys) { return keys.map(function (key) { return key === 'traits' ? obj[key] || {} : obj[key]; }); } function extractIdentifyFields(fields) { // all fields are optional for identify events if (!fields) { return []; } var props = getIdentifyProperties(fields); return extractFields(fields, props); } exports.extractIdentifyFields = extractIdentifyFields;