Sha256: 31de73946dc6a321fdb363727067f36f53af4771839c9bff655a592afcf247fd

Contents?: true

Size: 1.17 KB

Versions: 106

Compression:

Stored size: 1.17 KB

Contents

{"version":3,"names":["addComments","node","type","comments","key","concat","push"],"sources":["../../src/comments/addComments.ts"],"sourcesContent":["import type * as t from \"../index.ts\";\n\n/**\n * Add comments of certain type to a node.\n */\nexport default function addComments<T extends t.Node>(\n  node: T,\n  type: t.CommentTypeShorthand,\n  comments: Array<t.Comment>,\n): T {\n  if (!comments || !node) return node;\n\n  const key = `${type}Comments` as const;\n\n  if (node[key]) {\n    if (type === \"leading\") {\n      node[key] = comments.concat(node[key]);\n    } else {\n      node[key].push(...comments);\n    }\n  } else {\n    node[key] = comments;\n  }\n\n  return node;\n}\n"],"mappings":";;;;;;AAKe,SAASA,WAAWA,CACjCC,IAAO,EACPC,IAA4B,EAC5BC,QAA0B,EACvB;EACH,IAAI,CAACA,QAAQ,IAAI,CAACF,IAAI,EAAE,OAAOA,IAAI;EAEnC,MAAMG,GAAG,GAAG,GAAGF,IAAI,UAAmB;EAEtC,IAAID,IAAI,CAACG,GAAG,CAAC,EAAE;IACb,IAAIF,IAAI,KAAK,SAAS,EAAE;MACtBD,IAAI,CAACG,GAAG,CAAC,GAAGD,QAAQ,CAACE,MAAM,CAACJ,IAAI,CAACG,GAAG,CAAC,CAAC;IACxC,CAAC,MAAM;MACLH,IAAI,CAACG,GAAG,CAAC,CAACE,IAAI,CAAC,GAAGH,QAAQ,CAAC;IAC7B;EACF,CAAC,MAAM;IACLF,IAAI,CAACG,GAAG,CAAC,GAAGD,QAAQ;EACtB;EAEA,OAAOF,IAAI;AACb","ignoreList":[]}

Version data entries

106 entries across 7 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-transform-classes/node_modules/@babel/traverse/node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-transform-classes/node_modules/@babel/helper-replace-supers/node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-transform-async-generator-functions/node_modules/@babel/traverse/node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/node_modules/@babel/traverse/node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/helper-builder-binary-assignment-operator-visitor/node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/helper-wrap-function/node_modules/@babel/types/lib/comments/addComments.js.map