Sha256: 4448a1f111e1df1a9cef5d760e23873848db1efa55bc4fcd94fe24698ddfa18d

Contents?: true

Size: 1.17 KB

Versions: 55

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,GAAI,GAAEF,IAAK,UAAkB;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

55 entries across 15 versions & 2 rubygems

Version Path
immosquare-cleaner-0.1.48 node_modules/@babel/helper-member-expression-to-functions/node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.48 node_modules/@babel/helper-hoist-variables/node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.48 node_modules/@babel/helper-function-name/node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.48 node_modules/@babel/helper-environment-visitor/node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.47 node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.46 node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.45 node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.44 node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.43 node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.42 node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.41 node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.40 node_modules/@babel/types/lib/comments/addComments.js.map
wice_grid-7.1.0 node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.39 node_modules/@babel/types/lib/comments/addComments.js.map
immosquare-cleaner-0.1.38 node_modules/@babel/types/lib/comments/addComments.js.map