UNPKG

@rxreact/context

Version:

Dependency-inject an RxJS signal graph into your React components

16 lines 641 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var operators_1 = require("rxjs/operators"); /** * An operator to extract a property from an observable of an object. * Useful for pulling a specific prop from an observable of React props. * @param prop - The name of the object property * @returns - An observable of the object's property */ function getProp(prop) { return function (props$, compare) { return props$.pipe(operators_1.map(function (props) { return props[prop]; }), operators_1.distinctUntilChanged(compare)); }; } exports.getProp = getProp; //# sourceMappingURL=getProp.js.map