File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const omit = require ( 'lodash.omit' ) ;
43const matchHelper = require ( 'posthtml-match-helper' ) ;
54
65function _interopDefaultCompat ( e ) { return e && typeof e === 'object' && 'default' in e ? e . default : e ; }
76
8- const omit__default = /*#__PURE__*/ _interopDefaultCompat ( omit ) ;
97const matchHelper__default = /*#__PURE__*/ _interopDefaultCompat ( matchHelper ) ;
108
119const plugin = ( options = { } ) => ( tree ) => {
@@ -20,7 +18,9 @@ const plugin = (options = {}) => (tree) => {
2018 if ( k === "class" && node2 . attrs && node2 . attrs . class ) {
2119 node2 . attrs . class = [ .../* @__PURE__ */ new Set ( [ ...node2 . attrs . class . split ( " " ) , ...v . split ( " " ) ] ) ] . join ( " " ) ;
2220 } else {
23- const attributes2 = options . overwrite ? options . attributes [ key ] : omit__default ( options . attributes [ key ] , Object . keys ( node2 . attrs || { } ) ) ;
21+ const attributesToOmit = Object . keys ( node2 . attrs || { } ) ;
22+ const { [ attributesToOmit ] : _ , ...remainingAttributes } = options . attributes [ key ] ;
23+ const attributes2 = options . overwrite ? options . attributes [ key ] : remainingAttributes ;
2424 node2 . attrs = { ...node2 . attrs , ...attributes2 } ;
2525 }
2626 }
Original file line number Diff line number Diff line change 1- import omit from 'lodash.omit' ;
21import matchHelper from 'posthtml-match-helper' ;
32
43const plugin = ( options = { } ) => ( tree ) => {
@@ -13,7 +12,9 @@ const plugin = (options = {}) => (tree) => {
1312 if ( k === "class" && node2 . attrs && node2 . attrs . class ) {
1413 node2 . attrs . class = [ .../* @__PURE__ */ new Set ( [ ...node2 . attrs . class . split ( " " ) , ...v . split ( " " ) ] ) ] . join ( " " ) ;
1514 } else {
16- const attributes2 = options . overwrite ? options . attributes [ key ] : omit ( options . attributes [ key ] , Object . keys ( node2 . attrs || { } ) ) ;
15+ const attributesToOmit = Object . keys ( node2 . attrs || { } ) ;
16+ const { [ attributesToOmit ] : _ , ...remainingAttributes } = options . attributes [ key ] ;
17+ const attributes2 = options . overwrite ? options . attributes [ key ] : remainingAttributes ;
1718 node2 . attrs = { ...node2 . attrs , ...attributes2 } ;
1819 }
1920 }
You can’t perform that action at this time.
0 commit comments