UNPKG

d3plus-common

Version:

Common functions and methods used across D3plus modules.

10 lines 400 B
/** @function attrize @desc Applies each key/value in an object as an attr. @param {D3selection} elem The D3 element to apply the styles to. @param {Object} attrs An object of key/value attr pairs. */ export default function (e) { var a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; for (var k in a) if ({}.hasOwnProperty.call(a, k)) e.attr(k, a[k]); }