pogojs
Version:
Library to accompany the Pogo stack
31 lines (21 loc) • 983 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _hyphenToCamelCase = require('./hyphenToCamelCase');
var _hyphenToCamelCase2 = _interopRequireDefault(_hyphenToCamelCase);
var _each = require('./each');
var _each2 = _interopRequireDefault(_each);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var getCustomAttributeSet = function getCustomAttributeSet(el) {
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var attributeSet = {};
(0, _each2.default)(el.attributes, function (attribute) {
var att = attribute.nodeName.toLowerCase();
if (att.length >= prefix.length && att.substring(0, prefix.length) === prefix) {
attributeSet[(0, _hyphenToCamelCase2.default)(att.substring(prefix.length, att.length))] = attribute.nodeValue;
}
});
return attributeSet;
};
exports.default = getCustomAttributeSet;