UNPKG

@segment/analytics-next

Version:

Analytics Next (aka Analytics 2.0) is the latest version of Segment’s JavaScript SDK - enabling you to send your data to any tool without having to learn, test, or use a new API every time.

20 lines 640 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pickPrefix = void 0; /** * Returns an object containing only the properties prefixed by the input * string. * Ex: prefix('ajs_traits_', { ajs_traits_address: '123 St' }) * will return { address: '123 St' } **/ function pickPrefix(prefix, object) { return Object.keys(object).reduce(function (acc, key) { if (key.startsWith(prefix)) { var field = key.substr(prefix.length); acc[field] = object[key]; } return acc; }, {}); } exports.pickPrefix = pickPrefix; //# sourceMappingURL=pickPrefix.js.map