Skip to content

Commit

Permalink
feat: add attribute/sets transform
Browse files Browse the repository at this point in the history
  • Loading branch information
GarthDB committed Apr 4, 2022
1 parent ed4bc07 commit c3ad5f0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions attribute-sets-transform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
type: "attribute",
name: "attribute/sets",
matcher: (token) => token.path.includes("sets"),
transformer: (token) => {
return {
sets: token.path.filter(
(part, index, array) => array[index - 1] == "sets"
),
};
},
};
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const JsonSetsFormatter = require('./json-sets-formatter');
const JsonSetsFormatter = require("./json-sets-formatter");
const AttributeSetsTransform = require("./attribute-sets-transform");

module.exports = {JsonSetsFormatter};
module.exports = { JsonSetsFormatter, AttributeSetsTransform };

0 comments on commit c3ad5f0

Please sign in to comment.