@socketsecurity/cli-with-sentry 0.15.10 → 0.15.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/bin/cli.js +6 -6
  2. package/dist/.config/tsconfig.dts.tsbuildinfo +1 -1
  3. package/dist/cli.js +5731 -6607
  4. package/dist/cli.js.map +1 -1
  5. package/dist/constants.js +274 -305
  6. package/dist/constants.js.map +1 -1
  7. package/dist/instrument-with-sentry.js +28 -34
  8. package/dist/instrument-with-sentry.js.map +1 -1
  9. package/dist/shadow-bin.js +96 -123
  10. package/dist/shadow-bin.js.map +1 -1
  11. package/dist/shadow-inject.js +470 -580
  12. package/dist/shadow-inject.js.map +1 -1
  13. package/dist/socket-completion.bash +221 -0
  14. package/dist/types/cli.d.mts +2 -2
  15. package/dist/types/commands/analytics/cmd-analytics.d.mts +9 -15
  16. package/dist/types/commands/analytics/fetch-org-analytics.d.mts +4 -6
  17. package/dist/types/commands/analytics/fetch-repo-analytics.d.mts +4 -7
  18. package/dist/types/commands/analytics/handle-analytics.d.mts +9 -15
  19. package/dist/types/commands/analytics/handle-analytics.d.mts.map +1 -1
  20. package/dist/types/commands/analytics/output-analytics.d.mts +26 -46
  21. package/dist/types/commands/analytics/output-analytics.d.mts.map +1 -1
  22. package/dist/types/commands/audit-log/cmd-audit-log.d.mts +9 -15
  23. package/dist/types/commands/audit-log/fetch-audit-log.d.mts +10 -16
  24. package/dist/types/commands/audit-log/fetch-audit-log.d.mts.map +1 -1
  25. package/dist/types/commands/audit-log/handle-audit-log.d.mts +9 -15
  26. package/dist/types/commands/audit-log/handle-audit-log.d.mts.map +1 -1
  27. package/dist/types/commands/audit-log/output-audit-log.d.mts +22 -47
  28. package/dist/types/commands/audit-log/output-audit-log.d.mts.map +1 -1
  29. package/dist/types/commands/cdxgen/cmd-cdxgen.d.mts +9 -15
  30. package/dist/types/commands/cdxgen/cmd-cdxgen.d.mts.map +1 -1
  31. package/dist/types/commands/cdxgen/handle-cdxgen.d.mts +4 -0
  32. package/dist/types/commands/cdxgen/handle-cdxgen.d.mts.map +1 -0
  33. package/dist/types/commands/ci/cmd-ci.d.mts +9 -15
  34. package/dist/types/commands/ci/fetch-default-org-slug.d.mts +3 -3
  35. package/dist/types/commands/ci/handle-ci.d.mts +2 -2
  36. package/dist/types/commands/config/cmd-config-auto.d.mts +9 -15
  37. package/dist/types/commands/config/cmd-config-get.d.mts +9 -15
  38. package/dist/types/commands/config/cmd-config-list.d.mts +9 -15
  39. package/dist/types/commands/config/cmd-config-set.d.mts +9 -15
  40. package/dist/types/commands/config/cmd-config-unset.d.mts +9 -15
  41. package/dist/types/commands/config/cmd-config.d.mts +3 -3
  42. package/dist/types/commands/config/discover-config-value.d.mts +3 -5
  43. package/dist/types/commands/config/discover-config-value.d.mts.map +1 -1
  44. package/dist/types/commands/config/handle-config-auto.d.mts +7 -10
  45. package/dist/types/commands/config/handle-config-auto.d.mts.map +1 -1
  46. package/dist/types/commands/config/handle-config-get.d.mts +7 -10
  47. package/dist/types/commands/config/handle-config-get.d.mts.map +1 -1
  48. package/dist/types/commands/config/handle-config-set.d.mts +8 -12
  49. package/dist/types/commands/config/handle-config-set.d.mts.map +1 -1
  50. package/dist/types/commands/config/handle-config-unset.d.mts +7 -10
  51. package/dist/types/commands/config/handle-config-unset.d.mts.map +1 -1
  52. package/dist/types/commands/config/output-config-auto.d.mts +4 -8
  53. package/dist/types/commands/config/output-config-get.d.mts +4 -8
  54. package/dist/types/commands/config/output-config-list.d.mts +6 -9
  55. package/dist/types/commands/config/output-config-list.d.mts.map +1 -1
  56. package/dist/types/commands/config/output-config-set.d.mts +3 -6
  57. package/dist/types/commands/config/output-config-unset.d.mts +3 -6
  58. package/dist/types/commands/dependencies/cmd-dependencies.d.mts +9 -15
  59. package/dist/types/commands/dependencies/fetch-dependencies.d.mts +7 -10
  60. package/dist/types/commands/dependencies/fetch-dependencies.d.mts.map +1 -1
  61. package/dist/types/commands/dependencies/handle-dependencies.d.mts +7 -11
  62. package/dist/types/commands/dependencies/handle-dependencies.d.mts.map +1 -1
  63. package/dist/types/commands/dependencies/output-dependencies.d.mts +8 -15
  64. package/dist/types/commands/dependencies/output-dependencies.d.mts.map +1 -1
  65. package/dist/types/commands/diff-scan/cmd-diff-scan-get.d.mts +9 -15
  66. package/dist/types/commands/diff-scan/cmd-diff-scan.d.mts +3 -3
  67. package/dist/types/commands/diff-scan/fetch-diff-scan.d.mts +8 -12
  68. package/dist/types/commands/diff-scan/fetch-diff-scan.d.mts.map +1 -1
  69. package/dist/types/commands/diff-scan/handle-diff-scan.d.mts +10 -17
  70. package/dist/types/commands/diff-scan/handle-diff-scan.d.mts.map +1 -1
  71. package/dist/types/commands/diff-scan/output-diff-scan.d.mts +8 -15
  72. package/dist/types/commands/diff-scan/output-diff-scan.d.mts.map +1 -1
  73. package/dist/types/commands/fix/cmd-fix.d.mts +9 -15
  74. package/dist/types/commands/fix/git.d.mts +14 -49
  75. package/dist/types/commands/fix/npm-fix.d.mts +4 -16
  76. package/dist/types/commands/fix/npm-fix.d.mts.map +1 -1
  77. package/dist/types/commands/fix/open-pr.d.mts +20 -46
  78. package/dist/types/commands/fix/open-pr.d.mts.map +1 -1
  79. package/dist/types/commands/fix/pnpm-fix.d.mts +4 -16
  80. package/dist/types/commands/fix/pnpm-fix.d.mts.map +1 -1
  81. package/dist/types/commands/fix/run-fix.d.mts +3 -3
  82. package/dist/types/commands/fix/shared.d.mts +9 -15
  83. package/dist/types/commands/fix/types.d.mts +16 -16
  84. package/dist/types/commands/info/cmd-info.d.mts +9 -15
  85. package/dist/types/commands/info/fetch-package-info.d.mts +3 -7
  86. package/dist/types/commands/info/handle-package-info.d.mts +15 -22
  87. package/dist/types/commands/info/handle-package-info.d.mts.map +1 -1
  88. package/dist/types/commands/info/output-package-info.d.mts +10 -18
  89. package/dist/types/commands/info/output-package-info.d.mts.map +1 -1
  90. package/dist/types/commands/install/cmd-install-completion.d.mts +10 -0
  91. package/dist/types/commands/install/cmd-install-completion.d.mts.map +1 -0
  92. package/dist/types/commands/install/cmd-install.d.mts +3 -0
  93. package/dist/types/commands/install/cmd-install.d.mts.map +1 -0
  94. package/dist/types/commands/install/handle-install-completion.d.mts +2 -0
  95. package/dist/types/commands/install/handle-install-completion.d.mts.map +1 -0
  96. package/dist/types/commands/install/output-install-completion.d.mts +12 -0
  97. package/dist/types/commands/install/output-install-completion.d.mts.map +1 -0
  98. package/dist/types/commands/install/setup-tab-completion.d.mts +13 -0
  99. package/dist/types/commands/install/setup-tab-completion.d.mts.map +1 -0
  100. package/dist/types/commands/login/apply-login.d.mts +2 -7
  101. package/dist/types/commands/login/attempt-login.d.mts +2 -5
  102. package/dist/types/commands/login/attempt-login.d.mts.map +1 -1
  103. package/dist/types/commands/login/cmd-login.d.mts +9 -15
  104. package/dist/types/commands/logout/apply-logout.d.mts +2 -2
  105. package/dist/types/commands/logout/attempt-logout.d.mts +2 -2
  106. package/dist/types/commands/logout/cmd-logout.d.mts +9 -15
  107. package/dist/types/commands/manifest/cmd-manifest-auto.d.mts +9 -15
  108. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts +10 -0
  109. package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +1 -0
  110. package/dist/types/commands/manifest/cmd-manifest-conda.d.mts +9 -15
  111. package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts +9 -15
  112. package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts +9 -15
  113. package/dist/types/commands/manifest/cmd-manifest-scala.d.mts +9 -15
  114. package/dist/types/commands/manifest/cmd-manifest.d.mts +9 -15
  115. package/dist/types/commands/manifest/cmd-manifest.d.mts.map +1 -1
  116. package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts +7 -15
  117. package/dist/types/commands/manifest/convert_gradle_to_maven.d.mts +2 -8
  118. package/dist/types/commands/manifest/convert_sbt_to_maven.d.mts +2 -8
  119. package/dist/types/commands/manifest/handle-manifest-conda.d.mts +3 -9
  120. package/dist/types/commands/manifest/output-requirements.d.mts +6 -10
  121. package/dist/types/commands/{cdxgen → manifest}/run-cdxgen.d.mts +2 -2
  122. package/dist/types/commands/manifest/run-cdxgen.d.mts.map +1 -0
  123. package/dist/types/commands/npm/cmd-npm.d.mts +9 -15
  124. package/dist/types/commands/npx/cmd-npx.d.mts +9 -15
  125. package/dist/types/commands/oops/cmd-oops.d.mts +9 -15
  126. package/dist/types/commands/optimize/add-overrides.d.mts +18 -22
  127. package/dist/types/commands/optimize/apply-optimization.d.mts +2 -6
  128. package/dist/types/commands/optimize/cmd-optimize.d.mts +9 -15
  129. package/dist/types/commands/optimize/deps-includes-by-agent.d.mts +4 -7
  130. package/dist/types/commands/optimize/get-dependency-entries.d.mts +3 -5
  131. package/dist/types/commands/optimize/get-overrides-by-agent.d.mts +8 -11
  132. package/dist/types/commands/optimize/lockfile-includes-by-agent.d.mts +3 -10
  133. package/dist/types/commands/optimize/ls-by-agent.d.mts +6 -13
  134. package/dist/types/commands/optimize/shared.d.mts +2 -2
  135. package/dist/types/commands/optimize/types.d.mts +7 -7
  136. package/dist/types/commands/optimize/update-lockfile.d.mts +9 -12
  137. package/dist/types/commands/optimize/update-manifest-by-agent.d.mts +5 -11
  138. package/dist/types/commands/organization/cmd-organization-list.d.mts +9 -15
  139. package/dist/types/commands/organization/cmd-organization-policy-license.d.mts +9 -15
  140. package/dist/types/commands/organization/cmd-organization-policy-security.d.mts +9 -15
  141. package/dist/types/commands/organization/cmd-organization-policy.d.mts +3 -3
  142. package/dist/types/commands/organization/cmd-organization-quota.d.mts +9 -15
  143. package/dist/types/commands/organization/cmd-organization.d.mts +3 -3
  144. package/dist/types/commands/organization/fetch-license-policy.d.mts +4 -6
  145. package/dist/types/commands/organization/fetch-organization-list.d.mts +4 -6
  146. package/dist/types/commands/organization/fetch-quota.d.mts +4 -6
  147. package/dist/types/commands/organization/fetch-security-policy.d.mts +4 -6
  148. package/dist/types/commands/organization/handle-license-policy.d.mts +3 -6
  149. package/dist/types/commands/organization/handle-organization-list.d.mts +3 -5
  150. package/dist/types/commands/organization/handle-quota.d.mts +3 -3
  151. package/dist/types/commands/organization/handle-security-policy.d.mts +3 -6
  152. package/dist/types/commands/organization/output-license-policy.d.mts +4 -7
  153. package/dist/types/commands/organization/output-organization-list.d.mts +4 -7
  154. package/dist/types/commands/organization/output-quota.d.mts +4 -7
  155. package/dist/types/commands/organization/output-security-policy.d.mts +4 -7
  156. package/dist/types/commands/package/cmd-package-score.d.mts +9 -15
  157. package/dist/types/commands/package/cmd-package-shallow.d.mts +16 -22
  158. package/dist/types/commands/package/cmd-package.d.mts +3 -3
  159. package/dist/types/commands/package/fetch-purl-deep-score.d.mts +49 -51
  160. package/dist/types/commands/package/fetch-purls-shallow-score.d.mts +4 -6
  161. package/dist/types/commands/package/handle-purl-deep-score.d.mts +3 -6
  162. package/dist/types/commands/package/handle-purls-shallow-score.d.mts +6 -9
  163. package/dist/types/commands/package/handle-purls-shallow-score.d.mts.map +1 -1
  164. package/dist/types/commands/package/output-purl-score.d.mts +4 -8
  165. package/dist/types/commands/package/output-purls-shallow-score.d.mts +4 -8
  166. package/dist/types/commands/package/parse-package-specifiers.d.mts +5 -8
  167. package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts +9 -15
  168. package/dist/types/commands/raw-npm/run-raw-npm.d.mts +2 -4
  169. package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts +9 -15
  170. package/dist/types/commands/raw-npx/run-raw-npx.d.mts +2 -4
  171. package/dist/types/commands/report/cmd-report-create.d.mts +9 -15
  172. package/dist/types/commands/report/cmd-report-view.d.mts +9 -15
  173. package/dist/types/commands/report/cmd-report.d.mts +3 -3
  174. package/dist/types/commands/repos/cmd-repos-create.d.mts +9 -15
  175. package/dist/types/commands/repos/cmd-repos-del.d.mts +9 -15
  176. package/dist/types/commands/repos/cmd-repos-list.d.mts +9 -15
  177. package/dist/types/commands/repos/cmd-repos-update.d.mts +9 -15
  178. package/dist/types/commands/repos/cmd-repos-view.d.mts +9 -15
  179. package/dist/types/commands/repos/cmd-repos.d.mts +3 -3
  180. package/dist/types/commands/repos/fetch-create-repo.d.mts +11 -18
  181. package/dist/types/commands/repos/fetch-create-repo.d.mts.map +1 -1
  182. package/dist/types/commands/repos/fetch-delete-repo.d.mts +4 -7
  183. package/dist/types/commands/repos/fetch-list-repos.d.mts +10 -16
  184. package/dist/types/commands/repos/fetch-list-repos.d.mts.map +1 -1
  185. package/dist/types/commands/repos/fetch-update-repo.d.mts +11 -18
  186. package/dist/types/commands/repos/fetch-update-repo.d.mts.map +1 -1
  187. package/dist/types/commands/repos/fetch-view-repo.d.mts +4 -7
  188. package/dist/types/commands/repos/handle-create-repo.d.mts +10 -20
  189. package/dist/types/commands/repos/handle-create-repo.d.mts.map +1 -1
  190. package/dist/types/commands/repos/handle-delete-repo.d.mts +3 -7
  191. package/dist/types/commands/repos/handle-list-repos.d.mts +10 -17
  192. package/dist/types/commands/repos/handle-list-repos.d.mts.map +1 -1
  193. package/dist/types/commands/repos/handle-update-repo.d.mts +10 -20
  194. package/dist/types/commands/repos/handle-update-repo.d.mts.map +1 -1
  195. package/dist/types/commands/repos/handle-view-repo.d.mts +3 -7
  196. package/dist/types/commands/repos/output-create-repo.d.mts +4 -8
  197. package/dist/types/commands/repos/output-delete-repo.d.mts +4 -8
  198. package/dist/types/commands/repos/output-list-repos.d.mts +4 -7
  199. package/dist/types/commands/repos/output-update-repo.d.mts +4 -8
  200. package/dist/types/commands/repos/output-view-repo.d.mts +4 -7
  201. package/dist/types/commands/scan/cmd-scan-create.d.mts +9 -15
  202. package/dist/types/commands/scan/cmd-scan-del.d.mts +9 -15
  203. package/dist/types/commands/scan/cmd-scan-diff.d.mts +9 -15
  204. package/dist/types/commands/scan/cmd-scan-list.d.mts +3 -3
  205. package/dist/types/commands/scan/cmd-scan-metadata.d.mts +3 -3
  206. package/dist/types/commands/scan/cmd-scan-report.d.mts +3 -3
  207. package/dist/types/commands/scan/cmd-scan-view.d.mts +3 -3
  208. package/dist/types/commands/scan/cmd-scan.d.mts +3 -3
  209. package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts +11 -26
  210. package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts.map +1 -1
  211. package/dist/types/commands/scan/fetch-delete-org-full-scan.d.mts +4 -7
  212. package/dist/types/commands/scan/fetch-diff-scan.d.mts +8 -12
  213. package/dist/types/commands/scan/fetch-diff-scan.d.mts.map +1 -1
  214. package/dist/types/commands/scan/fetch-list-scans.d.mts +13 -22
  215. package/dist/types/commands/scan/fetch-list-scans.d.mts.map +1 -1
  216. package/dist/types/commands/scan/fetch-report-data.d.mts +8 -14
  217. package/dist/types/commands/scan/fetch-scan-metadata.d.mts +4 -7
  218. package/dist/types/commands/scan/fetch-scan.d.mts +4 -7
  219. package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts +4 -6
  220. package/dist/types/commands/scan/generate-report.d.mts +36 -50
  221. package/dist/types/commands/scan/generate-report.d.mts.map +1 -1
  222. package/dist/types/commands/scan/handle-create-new-scan.d.mts +20 -37
  223. package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +1 -1
  224. package/dist/types/commands/scan/handle-delete-scan.d.mts +3 -7
  225. package/dist/types/commands/scan/handle-diff-scan.d.mts +10 -17
  226. package/dist/types/commands/scan/handle-diff-scan.d.mts.map +1 -1
  227. package/dist/types/commands/scan/handle-list-scans.d.mts +13 -23
  228. package/dist/types/commands/scan/handle-list-scans.d.mts.map +1 -1
  229. package/dist/types/commands/scan/handle-scan-metadata.d.mts +3 -7
  230. package/dist/types/commands/scan/handle-scan-report.d.mts +12 -21
  231. package/dist/types/commands/scan/handle-scan-report.d.mts.map +1 -1
  232. package/dist/types/commands/scan/handle-scan-view.d.mts +3 -8
  233. package/dist/types/commands/scan/output-create-new-scan.d.mts +4 -8
  234. package/dist/types/commands/scan/output-delete-scan.d.mts +4 -7
  235. package/dist/types/commands/scan/output-diff-scan.d.mts +8 -15
  236. package/dist/types/commands/scan/output-diff-scan.d.mts.map +1 -1
  237. package/dist/types/commands/scan/output-list-scans.d.mts +4 -7
  238. package/dist/types/commands/scan/output-scan-metadata.d.mts +4 -8
  239. package/dist/types/commands/scan/output-scan-report.d.mts +20 -38
  240. package/dist/types/commands/scan/output-scan-report.d.mts.map +1 -1
  241. package/dist/types/commands/scan/output-scan-view.d.mts +4 -10
  242. package/dist/types/commands/scan/stream-scan.d.mts +2 -6
  243. package/dist/types/commands/scan/suggest-org-slug.d.mts +2 -2
  244. package/dist/types/commands/scan/suggest-repo-slug.d.mts +4 -4
  245. package/dist/types/commands/scan/suggest_branch_slug.d.mts +2 -4
  246. package/dist/types/commands/scan/suggest_target.d.mts +2 -2
  247. package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts +9 -15
  248. package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts +10 -16
  249. package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts.map +1 -1
  250. package/dist/types/commands/threat-feed/handle-threat-feed.d.mts +10 -17
  251. package/dist/types/commands/threat-feed/handle-threat-feed.d.mts.map +1 -1
  252. package/dist/types/commands/threat-feed/output-threat-feed.d.mts +4 -7
  253. package/dist/types/commands/threat-feed/types.d.mts +12 -12
  254. package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts +9 -0
  255. package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts.map +1 -0
  256. package/dist/types/commands/uninstall/cmd-uninstall.d.mts +3 -0
  257. package/dist/types/commands/uninstall/cmd-uninstall.d.mts.map +1 -0
  258. package/dist/types/commands/uninstall/handle-uninstall-completion.d.mts +2 -0
  259. package/dist/types/commands/uninstall/handle-uninstall-completion.d.mts.map +1 -0
  260. package/dist/types/commands/uninstall/output-uninstall-completion.d.mts +6 -0
  261. package/dist/types/commands/uninstall/output-uninstall-completion.d.mts.map +1 -0
  262. package/dist/types/commands/uninstall/teardown-tab-completion.d.mts +6 -0
  263. package/dist/types/commands/uninstall/teardown-tab-completion.d.mts.map +1 -0
  264. package/dist/types/commands/wrapper/add-socket-wrapper.d.mts +2 -2
  265. package/dist/types/commands/wrapper/check-socket-wrapper-setup.d.mts +2 -2
  266. package/dist/types/commands/wrapper/cmd-wrapper.d.mts +9 -15
  267. package/dist/types/commands/wrapper/postinstall-wrapper.d.mts +2 -2
  268. package/dist/types/commands/wrapper/postinstall-wrapper.d.mts.map +1 -1
  269. package/dist/types/commands/wrapper/remove-socket-wrapper.d.mts +2 -2
  270. package/dist/types/constants.d.mts +125 -135
  271. package/dist/types/constants.d.mts.map +1 -1
  272. package/dist/types/flags.d.mts +14 -17
  273. package/dist/types/flags.d.mts.map +1 -1
  274. package/dist/types/instrument-with-sentry.d.mts +2 -2
  275. package/dist/types/shadow/npm/arborist/index.d.mts +2 -2
  276. package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts +19 -24
  277. package/dist/types/shadow/npm/arborist/lib/arborist/types.d.mts +43 -71
  278. package/dist/types/shadow/npm/arborist/lib/dep-valid.d.mts +3 -8
  279. package/dist/types/shadow/npm/arborist/lib/edge.d.mts +58 -71
  280. package/dist/types/shadow/npm/arborist/lib/node.d.mts +55 -91
  281. package/dist/types/shadow/npm/arborist/lib/override-set.d.mts +26 -32
  282. package/dist/types/shadow/npm/arborist-helpers.d.mts +33 -66
  283. package/dist/types/shadow/npm/arborist-helpers.d.mts.map +1 -1
  284. package/dist/types/shadow/npm/bin.d.mts +2 -5
  285. package/dist/types/shadow/npm/inject.d.mts +2 -2
  286. package/dist/types/shadow/npm/install.d.mts +11 -16
  287. package/dist/types/shadow/npm/link.d.mts +2 -5
  288. package/dist/types/shadow/npm/paths.d.mts +7 -7
  289. package/dist/types/shadow/npm/proc-log/index.d.mts +3 -6
  290. package/dist/types/types.d.mts +15 -17
  291. package/dist/types/utils/agent.d.mts +11 -14
  292. package/dist/types/utils/alert/artifact.d.mts +32 -50
  293. package/dist/types/utils/alert/fix.d.mts +5 -5
  294. package/dist/types/utils/alert/severity.d.mts +12 -24
  295. package/dist/types/utils/alerts-map.d.mts +23 -36
  296. package/dist/types/utils/api.d.mts +11 -34
  297. package/dist/types/utils/check-input.d.mts +9 -12
  298. package/dist/types/utils/cmd.d.mts +4 -4
  299. package/dist/types/utils/color-or-markdown.d.mts +14 -23
  300. package/dist/types/utils/color-or-markdown.d.mts.map +1 -1
  301. package/dist/types/utils/completion.d.mts +11 -0
  302. package/dist/types/utils/completion.d.mts.map +1 -0
  303. package/dist/types/utils/config.d.mts +22 -31
  304. package/dist/types/utils/config.d.mts.map +1 -1
  305. package/dist/types/utils/determine-org-slug.d.mts +2 -7
  306. package/dist/types/utils/errors.d.mts +12 -21
  307. package/dist/types/utils/fail-msg-with-badge.d.mts +2 -5
  308. package/dist/types/utils/fs.d.mts +21 -52
  309. package/dist/types/utils/get-output-kind.d.mts +3 -6
  310. package/dist/types/utils/glob.d.mts +13 -24
  311. package/dist/types/utils/map-to-object.d.mts +4 -6
  312. package/dist/types/utils/markdown.d.mts +4 -15
  313. package/dist/types/utils/meow-with-subcommands.d.mts +34 -46
  314. package/dist/types/utils/meow-with-subcommands.d.mts.map +1 -1
  315. package/dist/types/utils/npm-paths.d.mts +7 -7
  316. package/dist/types/utils/npm-paths.d.mts.map +1 -1
  317. package/dist/types/utils/objects.d.mts +3 -8
  318. package/dist/types/utils/output-formatting.d.mts +14 -24
  319. package/dist/types/utils/package-environment.d.mts +51 -72
  320. package/dist/types/utils/package-environment.d.mts.map +1 -1
  321. package/dist/types/utils/path-resolve.d.mts +9 -14
  322. package/dist/types/utils/pnpm.d.mts +9 -7
  323. package/dist/types/utils/pnpm.d.mts.map +1 -1
  324. package/dist/types/utils/sdk.d.mts +8 -12
  325. package/dist/types/utils/semver.d.mts +5 -17
  326. package/dist/types/utils/serialize-result-json.d.mts +3 -3
  327. package/dist/types/utils/socket-package-alert.d.mts +62 -81
  328. package/dist/types/utils/socket-url.d.mts +9 -15
  329. package/dist/types/utils/spec.d.mts +4 -7
  330. package/dist/types/utils/spec.d.mts.map +1 -1
  331. package/dist/types/utils/strings.d.mts +2 -5
  332. package/dist/types/utils/translations.d.mts +592 -592
  333. package/dist/types/utils/walk-nested-map.d.mts +7 -10
  334. package/dist/utils.js +1531 -1833
  335. package/dist/utils.js.map +1 -1
  336. package/dist/vendor.js +38333 -51605
  337. package/dist/vendor.js.map +1 -1
  338. package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +5 -8
  339. package/external/@socketsecurity/registry/external/@npmcli/promise-spawn.js +2 -4
  340. package/external/@socketsecurity/registry/external/cacache.js +1 -2
  341. package/external/@socketsecurity/registry/external/libnpmpack.js +36 -76
  342. package/external/@socketsecurity/registry/external/make-fetch-happen.js +31 -67
  343. package/external/@socketsecurity/registry/external/pacote.js +36 -76
  344. package/external/@socketsecurity/registry/external/tinyglobby.js +3 -6
  345. package/external/@socketsecurity/registry/external/which.js +2 -4
  346. package/external/@socketsecurity/registry/lib/logger.d.ts +4 -1
  347. package/external/@socketsecurity/registry/lib/logger.js +160 -73
  348. package/external/@socketsecurity/registry/lib/spinner.js +5 -1
  349. package/external/@socketsecurity/registry/package.json +2 -2
  350. package/external/blessed/lib/alias.js +475 -468
  351. package/external/blessed/lib/blessed.js +12 -12
  352. package/external/blessed/lib/colors.js +234 -194
  353. package/external/blessed/lib/events.js +64 -70
  354. package/external/blessed/lib/gpmclient.js +117 -141
  355. package/external/blessed/lib/helpers.js +89 -94
  356. package/external/blessed/lib/keys.js +169 -342
  357. package/external/blessed/lib/program.js +2130 -2365
  358. package/external/blessed/lib/tput.js +1183 -1276
  359. package/external/blessed/lib/unicode.js +400 -522
  360. package/external/blessed/lib/widget.js +14 -14
  361. package/external/blessed/lib/widgets/ansiimage.js +90 -96
  362. package/external/blessed/lib/widgets/bigtext.js +91 -102
  363. package/external/blessed/lib/widgets/box.js +8 -8
  364. package/external/blessed/lib/widgets/button.js +23 -23
  365. package/external/blessed/lib/widgets/checkbox.js +50 -54
  366. package/external/blessed/lib/widgets/element.js +1415 -1716
  367. package/external/blessed/lib/widgets/filemanager.js +107 -118
  368. package/external/blessed/lib/widgets/form.js +144 -178
  369. package/external/blessed/lib/widgets/image.js +26 -36
  370. package/external/blessed/lib/widgets/input.js +8 -8
  371. package/external/blessed/lib/widgets/layout.js +103 -119
  372. package/external/blessed/lib/widgets/line.js +17 -20
  373. package/external/blessed/lib/widgets/list.js +349 -402
  374. package/external/blessed/lib/widgets/listbar.js +265 -306
  375. package/external/blessed/lib/widgets/listtable.js +133 -146
  376. package/external/blessed/lib/widgets/loading.js +31 -31
  377. package/external/blessed/lib/widgets/log.js +41 -40
  378. package/external/blessed/lib/widgets/message.js +64 -86
  379. package/external/blessed/lib/widgets/node.js +175 -207
  380. package/external/blessed/lib/widgets/overlayimage.js +360 -437
  381. package/external/blessed/lib/widgets/progressbar.js +79 -88
  382. package/external/blessed/lib/widgets/prompt.js +54 -61
  383. package/external/blessed/lib/widgets/question.js +48 -61
  384. package/external/blessed/lib/widgets/radiobutton.js +26 -27
  385. package/external/blessed/lib/widgets/radioset.js +8 -8
  386. package/external/blessed/lib/widgets/screen.js +1186 -1375
  387. package/external/blessed/lib/widgets/scrollablebox.js +202 -228
  388. package/external/blessed/lib/widgets/scrollabletext.js +9 -9
  389. package/external/blessed/lib/widgets/table.js +187 -216
  390. package/external/blessed/lib/widgets/terminal.js +258 -298
  391. package/external/blessed/lib/widgets/text.js +9 -9
  392. package/external/blessed/lib/widgets/textarea.js +188 -222
  393. package/external/blessed/lib/widgets/textbox.js +34 -36
  394. package/external/blessed/lib/widgets/video.js +55 -59
  395. package/external/blessed/usr/fonts/ter-u14b.json +1 -1
  396. package/external/blessed/usr/fonts/ter-u14n.json +1 -1
  397. package/external/blessed/vendor/tng.js +1016 -1144
  398. package/external/blessed-contrib/lib/layout/grid.js +345 -377
  399. package/external/blessed-contrib/lib/widget/charts/bar.js +6612 -7139
  400. package/external/blessed-contrib/lib/widget/charts/line.js +16224 -23941
  401. package/external/blessed-contrib/lib/widget/table.js +78 -96
  402. package/package.json +9 -9
  403. package/dist/types/commands/cdxgen/run-cdxgen.d.mts.map +0 -1
@@ -23,10 +23,10 @@
23
23
  * Modules
24
24
  */
25
25
 
26
- const assert = require('assert'),
27
- path = require('path'),
28
- fs = require('fs'),
29
- cp = require('child_process')
26
+ var assert = require('assert')
27
+ , path = require('path')
28
+ , fs = require('fs')
29
+ , cp = require('child_process');
30
30
 
31
31
  /**
32
32
  * Tput
@@ -34,110 +34,101 @@ const assert = require('assert'),
34
34
 
35
35
  function Tput(options) {
36
36
  if (!(this instanceof Tput)) {
37
- return new Tput(options)
37
+ return new Tput(options);
38
38
  }
39
39
 
40
- options = options || {}
40
+ options = options || {};
41
41
  if (typeof options === 'string') {
42
- options = { terminal: options }
42
+ options = { terminal: options };
43
43
  }
44
44
 
45
- this.options = options
46
- this.terminal =
47
- options.terminal ||
48
- options.term ||
49
- process.env.TERM ||
50
- (process.platform === 'win32' ? 'windows-ansi' : 'xterm')
45
+ this.options = options;
46
+ this.terminal = options.terminal
47
+ || options.term
48
+ || process.env.TERM
49
+ || (process.platform === 'win32' ? 'windows-ansi' : 'xterm');
51
50
 
52
- this.terminal = this.terminal.toLowerCase()
51
+ this.terminal = this.terminal.toLowerCase();
53
52
 
54
- this.debug = options.debug
55
- this.padding = options.padding
56
- this.extended = options.extended
57
- this.printf = options.printf
58
- this.termcap = options.termcap
59
- this.error = null
53
+ this.debug = options.debug;
54
+ this.padding = options.padding;
55
+ this.extended = options.extended;
56
+ this.printf = options.printf;
57
+ this.termcap = options.termcap;
58
+ this.error = null;
60
59
 
61
- this.terminfoPrefix = options.terminfoPrefix
62
- this.terminfoFile = options.terminfoFile
63
- this.termcapFile = options.termcapFile
60
+ this.terminfoPrefix = options.terminfoPrefix;
61
+ this.terminfoFile = options.terminfoFile;
62
+ this.termcapFile = options.termcapFile;
64
63
 
65
64
  if (options.terminal || options.term) {
66
- this.setup()
65
+ this.setup();
67
66
  }
68
67
  }
69
68
 
70
- Tput.prototype.setup = function () {
71
- this.error = null
69
+ Tput.prototype.setup = function() {
70
+ this.error = null;
72
71
  try {
73
72
  if (this.termcap) {
74
73
  try {
75
- this.injectTermcap()
74
+ this.injectTermcap();
76
75
  } catch (e) {
77
- if (this.debug) {
78
- throw e
79
- }
80
- this.error = new Error('Termcap parse error.')
81
- this._useInternalCap(this.terminal)
76
+ if (this.debug) throw e;
77
+ this.error = new Error('Termcap parse error.');
78
+ this._useInternalCap(this.terminal);
82
79
  }
83
80
  } else {
84
81
  try {
85
- this.injectTerminfo()
82
+ this.injectTerminfo();
86
83
  } catch (e) {
87
- if (this.debug) {
88
- throw e
89
- }
90
- this.error = new Error('Terminfo parse error.')
91
- this._useInternalInfo(this.terminal)
84
+ if (this.debug) throw e;
85
+ this.error = new Error('Terminfo parse error.');
86
+ this._useInternalInfo(this.terminal);
92
87
  }
93
88
  }
94
89
  } catch (e) {
95
90
  // If there was an error, fallback
96
91
  // to an internally stored terminfo/cap.
97
- if (this.debug) {
98
- throw e
99
- }
100
- this.error = new Error('Terminfo not found.')
101
- this._useXtermInfo()
92
+ if (this.debug) throw e;
93
+ this.error = new Error('Terminfo not found.');
94
+ this._useXtermInfo();
102
95
  }
103
- }
96
+ };
104
97
 
105
- Tput.prototype.term = function (is) {
106
- return this.terminal.indexOf(is) === 0
107
- }
98
+ Tput.prototype.term = function(is) {
99
+ return this.terminal.indexOf(is) === 0;
100
+ };
108
101
 
109
- Tput.prototype._debug = function () {
110
- if (!this.debug) {
111
- return
112
- }
113
- return console.log.apply(console, arguments)
114
- }
102
+ Tput.prototype._debug = function() {
103
+ if (!this.debug) return;
104
+ return console.log.apply(console, arguments);
105
+ };
115
106
 
116
107
  /**
117
108
  * Fallback
118
109
  */
119
110
 
120
- Tput.prototype._useVt102Cap = function () {
121
- return this.injectTermcap('vt102')
122
- }
111
+ Tput.prototype._useVt102Cap = function() {
112
+ return this.injectTermcap('vt102');
113
+ };
123
114
 
124
- Tput.prototype._useXtermCap = function () {
125
- return this.injectTermcap(__dirname + '/../usr/xterm.termcap')
126
- }
115
+ Tput.prototype._useXtermCap = function() {
116
+ return this.injectTermcap(__dirname + '/../usr/xterm.termcap');
117
+ };
127
118
 
128
- Tput.prototype._useXtermInfo = function () {
129
- return this.injectTerminfo(__dirname + '/../usr/xterm')
130
- }
119
+ Tput.prototype._useXtermInfo = function() {
120
+ return this.injectTerminfo(__dirname + '/../usr/xterm');
121
+ };
131
122
 
132
- Tput.prototype._useInternalInfo = function (name) {
133
- name = path.basename(name)
134
- return this.injectTerminfo(__dirname + '/../usr/' + name)
135
- }
123
+ Tput.prototype._useInternalInfo = function(name) {
124
+ name = path.basename(name);
125
+ return this.injectTerminfo(__dirname + '/../usr/' + name);
126
+ };
136
127
 
137
- Tput.prototype._useInternalCap = function (name) {
138
- name = path.basename(name)
139
- return this.injectTermcap(__dirname + '/../usr/' + name + '.termcap')
140
- }
128
+ Tput.prototype._useInternalCap = function(name) {
129
+ name = path.basename(name);
130
+ return this.injectTermcap(__dirname + '/../usr/' + name + '.termcap');
131
+ };
141
132
 
142
133
  /**
143
134
  * Terminfo
@@ -155,160 +146,167 @@ Tput.ipaths = [
155
146
  '/usr/local/lib/terminfo',
156
147
  '/usr/local/ncurses/lib/terminfo',
157
148
  '/lib/terminfo'
158
- ]
149
+ ];
159
150
 
160
- Tput.prototype.readTerminfo = function (term) {
161
- let data, file, info
151
+ Tput.prototype.readTerminfo = function(term) {
152
+ var data
153
+ , file
154
+ , info;
162
155
 
163
- term = term || this.terminal
156
+ term = term || this.terminal;
164
157
 
165
- file = path.normalize(this._prefix(term))
166
- data = fs.readFileSync(file)
167
- info = this.parseTerminfo(data, file)
158
+ file = path.normalize(this._prefix(term));
159
+ data = fs.readFileSync(file);
160
+ info = this.parseTerminfo(data, file);
168
161
 
169
162
  if (this.debug) {
170
- this._terminfo = info
163
+ this._terminfo = info;
171
164
  }
172
165
 
173
- return info
174
- }
166
+ return info;
167
+ };
175
168
 
176
- Tput._prefix = Tput.prototype._prefix = function (term) {
169
+ Tput._prefix =
170
+ Tput.prototype._prefix = function(term) {
177
171
  // If we have a terminfoFile, or our
178
172
  // term looks like a filename, use it.
179
173
  if (term) {
180
174
  if (~term.indexOf(path.sep)) {
181
- return term
175
+ return term;
182
176
  }
183
177
  if (this.terminfoFile) {
184
- return this.terminfoFile
178
+ return this.terminfoFile;
185
179
  }
186
180
  }
187
181
 
188
- let paths = Tput.ipaths.slice(),
189
- file
182
+ var paths = Tput.ipaths.slice()
183
+ , file;
190
184
 
191
185
  if (this.terminfoPrefix) {
192
- paths.unshift(this.terminfoPrefix)
186
+ paths.unshift(this.terminfoPrefix);
193
187
  }
194
188
 
195
189
  // Try exact matches.
196
- file = this._tprefix(paths, term)
197
- if (file) {
198
- return file
199
- }
190
+ file = this._tprefix(paths, term);
191
+ if (file) return file;
200
192
 
201
193
  // Try similar matches.
202
- file = this._tprefix(paths, term, true)
203
- if (file) {
204
- return file
205
- }
194
+ file = this._tprefix(paths, term, true);
195
+ if (file) return file;
206
196
 
207
197
  // Not found.
208
- throw new Error('Terminfo directory not found.')
209
- }
198
+ throw new Error('Terminfo directory not found.');
199
+ };
210
200
 
211
- Tput._tprefix = Tput.prototype._tprefix = function (prefix, term, soft) {
212
- if (!prefix) {
213
- return
214
- }
201
+ Tput._tprefix =
202
+ Tput.prototype._tprefix = function(prefix, term, soft) {
203
+ if (!prefix) return;
215
204
 
216
- let file, dir, i, sdiff, sfile, list
205
+ var file
206
+ , dir
207
+ , i
208
+ , sdiff
209
+ , sfile
210
+ , list;
217
211
 
218
212
  if (Array.isArray(prefix)) {
219
213
  for (i = 0; i < prefix.length; i++) {
220
- file = this._tprefix(prefix[i], term, soft)
221
- if (file) {
222
- return file
223
- }
214
+ file = this._tprefix(prefix[i], term, soft);
215
+ if (file) return file;
224
216
  }
225
- return
217
+ return;
226
218
  }
227
219
 
228
- const find = function (word) {
229
- let file, ch
220
+ var find = function(word) {
221
+ var file, ch;
230
222
 
231
- file = path.resolve(prefix, word[0])
223
+ file = path.resolve(prefix, word[0]);
232
224
  try {
233
- fs.statSync(file)
234
- return file
235
- } catch (e) {}
236
-
237
- ch = word[0].charCodeAt(0).toString(16)
238
- if (ch.length < 2) {
239
- ch = '0' + ch
225
+ fs.statSync(file);
226
+ return file;
227
+ } catch (e) {
228
+ ;
240
229
  }
241
230
 
242
- file = path.resolve(prefix, ch)
231
+ ch = word[0].charCodeAt(0).toString(16);
232
+ if (ch.length < 2) ch = '0' + ch;
233
+
234
+ file = path.resolve(prefix, ch);
243
235
  try {
244
- fs.statSync(file)
245
- return file
246
- } catch (e) {}
247
- }
236
+ fs.statSync(file);
237
+ return file;
238
+ } catch (e) {
239
+ ;
240
+ }
241
+ };
248
242
 
249
243
  if (!term) {
250
244
  // Make sure the directory's sub-directories
251
245
  // are all one-letter, or hex digits.
252
246
  // return find('x') ? prefix : null;
253
247
  try {
254
- dir = fs.readdirSync(prefix).filter(function (file) {
255
- return file.length !== 1 && !/^[0-9a-fA-F]{2}$/.test(file)
256
- })
248
+ dir = fs.readdirSync(prefix).filter(function(file) {
249
+ return file.length !== 1 && !/^[0-9a-fA-F]{2}$/.test(file);
250
+ });
257
251
  if (!dir.length) {
258
- return prefix
252
+ return prefix;
259
253
  }
260
- } catch (e) {}
261
- return
254
+ } catch (e) {
255
+ ;
256
+ }
257
+ return;
262
258
  }
263
259
 
264
- term = path.basename(term)
265
- dir = find(term)
260
+ term = path.basename(term);
261
+ dir = find(term);
266
262
 
267
- if (!dir) {
268
- return
269
- }
263
+ if (!dir) return;
270
264
 
271
265
  if (soft) {
272
266
  try {
273
- list = fs.readdirSync(dir)
267
+ list = fs.readdirSync(dir);
274
268
  } catch (e) {
275
- return
269
+ return;
276
270
  }
277
271
 
278
- list.forEach(function (file) {
272
+ list.forEach(function(file) {
279
273
  if (file.indexOf(term) === 0) {
280
- const diff = file.length - term.length
274
+ var diff = file.length - term.length;
281
275
  if (!sfile || diff < sdiff) {
282
- sdiff = diff
283
- sfile = file
276
+ sdiff = diff;
277
+ sfile = file;
284
278
  }
285
279
  }
286
- })
280
+ });
287
281
 
288
- return sfile && (soft || sdiff === 0) ? path.resolve(dir, sfile) : null
282
+ return sfile && (soft || sdiff === 0)
283
+ ? path.resolve(dir, sfile)
284
+ : null;
289
285
  }
290
286
 
291
- file = path.resolve(dir, term)
287
+ file = path.resolve(dir, term);
292
288
  try {
293
- fs.statSync(file)
294
- return file
295
- } catch (e) {}
296
- }
289
+ fs.statSync(file);
290
+ return file;
291
+ } catch (e) {
292
+ ;
293
+ }
294
+ };
297
295
 
298
296
  /**
299
297
  * Terminfo Parser
300
298
  * All shorts are little-endian
301
299
  */
302
300
 
303
- Tput.prototype.parseTerminfo = function (data, file) {
304
- let info = {},
305
- extended,
306
- l = data.length,
307
- i = 0,
308
- v,
309
- o
301
+ Tput.prototype.parseTerminfo = function(data, file) {
302
+ var info = {}
303
+ , extended
304
+ , l = data.length
305
+ , i = 0
306
+ , v
307
+ , o;
310
308
 
311
- const h = (info.header = {
309
+ var h = info.header = {
312
310
  dataSize: data.length,
313
311
  headerSize: 12,
314
312
  magicNumber: (data[1] << 8) | data[0],
@@ -317,85 +315,84 @@ Tput.prototype.parseTerminfo = function (data, file) {
317
315
  numCount: (data[7] << 8) | data[6],
318
316
  strCount: (data[9] << 8) | data[8],
319
317
  strTableSize: (data[11] << 8) | data[10]
320
- })
318
+ };
321
319
 
322
- h.total =
323
- h.headerSize +
324
- h.namesSize +
325
- h.boolCount +
326
- h.numCount * 2 +
327
- h.strCount * 2 +
328
- h.strTableSize
320
+ h.total = h.headerSize
321
+ + h.namesSize
322
+ + h.boolCount
323
+ + h.numCount * 2
324
+ + h.strCount * 2
325
+ + h.strTableSize;
329
326
 
330
- i += h.headerSize
327
+ i += h.headerSize;
331
328
 
332
329
  // Names Section
333
- const names = data.toString('ascii', i, i + h.namesSize - 1),
334
- parts = names.split('|'),
335
- name = parts[0],
336
- desc = parts.pop()
330
+ var names = data.toString('ascii', i, i + h.namesSize - 1)
331
+ , parts = names.split('|')
332
+ , name = parts[0]
333
+ , desc = parts.pop();
337
334
 
338
- info.name = name
339
- info.names = parts
340
- info.desc = desc
335
+ info.name = name;
336
+ info.names = parts;
337
+ info.desc = desc;
341
338
 
342
- info.dir = path.resolve(file, '..', '..')
343
- info.file = file
339
+ info.dir = path.resolve(file, '..', '..');
340
+ info.file = file;
344
341
 
345
- i += h.namesSize - 1
342
+ i += h.namesSize - 1;
346
343
 
347
344
  // Names is nul-terminated.
348
- assert.equal(data[i], 0)
349
- i++
345
+ assert.equal(data[i], 0);
346
+ i++;
350
347
 
351
348
  // Booleans Section
352
349
  // One byte for each flag
353
350
  // Same order as <term.h>
354
- info.bools = {}
355
- l = i + h.boolCount
356
- o = 0
351
+ info.bools = {};
352
+ l = i + h.boolCount;
353
+ o = 0;
357
354
  for (; i < l; i++) {
358
- v = Tput.bools[o++]
359
- info.bools[v] = data[i] === 1
355
+ v = Tput.bools[o++];
356
+ info.bools[v] = data[i] === 1;
360
357
  }
361
358
 
362
359
  // Null byte in between to make sure numbers begin on an even byte.
363
360
  if (i % 2) {
364
- assert.equal(data[i], 0)
365
- i++
361
+ assert.equal(data[i], 0);
362
+ i++;
366
363
  }
367
364
 
368
365
  // Numbers Section
369
- info.numbers = {}
370
- l = i + h.numCount * 2
371
- o = 0
366
+ info.numbers = {};
367
+ l = i + h.numCount * 2;
368
+ o = 0;
372
369
  for (; i < l; i += 2) {
373
- v = Tput.numbers[o++]
374
- if (data[i + 1] === 0xff && data[i] === 0xff) {
375
- info.numbers[v] = -1
370
+ v = Tput.numbers[o++];
371
+ if (data[i + 1] === 0xFF && data[i] === 0xFF) {
372
+ info.numbers[v] = -1;
376
373
  } else {
377
- info.numbers[v] = (data[i + 1] << 8) | data[i]
374
+ info.numbers[v] = (data[i + 1] << 8) | data[i];
378
375
  }
379
376
  }
380
377
 
381
378
  // Strings Section
382
- info.strings = {}
383
- l = i + h.strCount * 2
384
- o = 0
379
+ info.strings = {};
380
+ l = i + h.strCount * 2;
381
+ o = 0;
385
382
  for (; i < l; i += 2) {
386
- v = Tput.strings[o++]
387
- if (data[i + 1] === 0xff && data[i] === 0xff) {
388
- info.strings[v] = -1
383
+ v = Tput.strings[o++];
384
+ if (data[i + 1] === 0xFF && data[i] === 0xFF) {
385
+ info.strings[v] = -1;
389
386
  } else {
390
- info.strings[v] = (data[i + 1] << 8) | data[i]
387
+ info.strings[v] = (data[i + 1] << 8) | data[i];
391
388
  }
392
389
  }
393
390
 
394
391
  // String Table
395
- Object.keys(info.strings).forEach(function (key) {
392
+ Object.keys(info.strings).forEach(function(key) {
396
393
  if (info.strings[key] === -1) {
397
- delete info.strings[key]
398
- return
394
+ delete info.strings[key];
395
+ return;
399
396
  }
400
397
 
401
398
  // Workaround: fix an odd bug in the screen-256color terminfo where it tries
@@ -403,49 +400,47 @@ Tput.prototype.parseTerminfo = function (data, file) {
403
400
  // TODO: Possibly handle errors gracefully below, as well as in the
404
401
  // extended info. Also possibly do: `if (info.strings[key] >= data.length)`.
405
402
  if (info.strings[key] === 65534) {
406
- delete info.strings[key]
407
- return
403
+ delete info.strings[key];
404
+ return;
408
405
  }
409
406
 
410
- let s = i + info.strings[key],
411
- j = s
407
+ var s = i + info.strings[key]
408
+ , j = s;
412
409
 
413
- while (data[j]) {
414
- j++
415
- }
410
+ while (data[j]) j++;
416
411
 
417
- assert(j < data.length)
412
+ assert(j < data.length);
418
413
 
419
- info.strings[key] = data.toString('ascii', s, j)
420
- })
414
+ info.strings[key] = data.toString('ascii', s, j);
415
+ });
421
416
 
422
417
  // Extended Header
423
418
  if (this.extended !== false) {
424
- i--
425
- i += h.strTableSize
419
+ i--;
420
+ i += h.strTableSize;
426
421
  if (i % 2) {
427
- assert.equal(data[i], 0)
428
- i++
422
+ assert.equal(data[i], 0);
423
+ i++;
429
424
  }
430
- l = data.length
425
+ l = data.length;
431
426
  if (i < l - 1) {
432
427
  try {
433
- extended = this.parseExtended(data.slice(i))
428
+ extended = this.parseExtended(data.slice(i));
434
429
  } catch (e) {
435
430
  if (this.debug) {
436
- throw e
431
+ throw e;
437
432
  }
438
- return info
433
+ return info;
439
434
  }
440
- info.header.extended = extended.header
441
- ;['bools', 'numbers', 'strings'].forEach(function (key) {
442
- merge(info[key], extended[key])
443
- })
435
+ info.header.extended = extended.header;
436
+ ['bools', 'numbers', 'strings'].forEach(function(key) {
437
+ merge(info[key], extended[key]);
438
+ });
444
439
  }
445
440
  }
446
441
 
447
- return info
448
- }
442
+ return info;
443
+ };
449
444
 
450
445
  /**
451
446
  * Extended Parsing
@@ -497,12 +492,12 @@ Tput.prototype.parseTerminfo = function (data, file) {
497
492
  // h.symOffsetCount = h.strTableSize - h.strCount;
498
493
  // h.symOffsetSize = (h.strTableSize - h.strCount) * 2;
499
494
 
500
- Tput.prototype.parseExtended = function (data) {
501
- let info = {},
502
- l = data.length,
503
- i = 0
495
+ Tput.prototype.parseExtended = function(data) {
496
+ var info = {}
497
+ , l = data.length
498
+ , i = 0;
504
499
 
505
- const h = (info.header = {
500
+ var h = info.header = {
506
501
  dataSize: data.length,
507
502
  headerSize: 10,
508
503
  boolCount: (data[i + 1] << 8) | data[i + 0],
@@ -510,253 +505,240 @@ Tput.prototype.parseExtended = function (data) {
510
505
  strCount: (data[i + 5] << 8) | data[i + 4],
511
506
  strTableSize: (data[i + 7] << 8) | data[i + 6],
512
507
  lastStrTableOffset: (data[i + 9] << 8) | data[i + 8]
513
- })
508
+ };
514
509
 
515
510
  // h.symOffsetCount = h.strTableSize - h.strCount;
516
511
 
517
- h.total =
518
- h.headerSize +
519
- h.boolCount +
520
- h.numCount * 2 +
521
- h.strCount * 2 +
522
- h.strTableSize
512
+ h.total = h.headerSize
513
+ + h.boolCount
514
+ + h.numCount * 2
515
+ + h.strCount * 2
516
+ + h.strTableSize;
523
517
 
524
- i += h.headerSize
518
+ i += h.headerSize;
525
519
 
526
520
  // Booleans Section
527
521
  // One byte for each flag
528
- const _bools = []
529
- l = i + h.boolCount
522
+ var _bools = [];
523
+ l = i + h.boolCount;
530
524
  for (; i < l; i++) {
531
- _bools.push(data[i] === 1)
525
+ _bools.push(data[i] === 1);
532
526
  }
533
527
 
534
528
  // Null byte in between to make sure numbers begin on an even byte.
535
529
  if (i % 2) {
536
- assert.equal(data[i], 0)
537
- i++
530
+ assert.equal(data[i], 0);
531
+ i++;
538
532
  }
539
533
 
540
534
  // Numbers Section
541
- const _numbers = []
542
- l = i + h.numCount * 2
535
+ var _numbers = [];
536
+ l = i + h.numCount * 2;
543
537
  for (; i < l; i += 2) {
544
- if (data[i + 1] === 0xff && data[i] === 0xff) {
545
- _numbers.push(-1)
538
+ if (data[i + 1] === 0xFF && data[i] === 0xFF) {
539
+ _numbers.push(-1);
546
540
  } else {
547
- _numbers.push((data[i + 1] << 8) | data[i])
541
+ _numbers.push((data[i + 1] << 8) | data[i]);
548
542
  }
549
543
  }
550
544
 
551
545
  // Strings Section
552
- const _strings = []
553
- l = i + h.strCount * 2
546
+ var _strings = [];
547
+ l = i + h.strCount * 2;
554
548
  for (; i < l; i += 2) {
555
- if (data[i + 1] === 0xff && data[i] === 0xff) {
556
- _strings.push(-1)
549
+ if (data[i + 1] === 0xFF && data[i] === 0xFF) {
550
+ _strings.push(-1);
557
551
  } else {
558
- _strings.push((data[i + 1] << 8) | data[i])
552
+ _strings.push((data[i + 1] << 8) | data[i]);
559
553
  }
560
554
  }
561
555
 
562
556
  // Pass over the sym offsets and get to the string table.
563
- i = data.length - h.lastStrTableOffset
557
+ i = data.length - h.lastStrTableOffset;
564
558
  // Might be better to do this instead if the file has trailing bytes:
565
559
  // i += h.symOffsetCount * 2;
566
560
 
567
561
  // String Table
568
- let high = 0
569
- _strings.forEach(function (offset, k) {
562
+ var high = 0;
563
+ _strings.forEach(function(offset, k) {
570
564
  if (offset === -1) {
571
- _strings[k] = ''
572
- return
565
+ _strings[k] = '';
566
+ return;
573
567
  }
574
568
 
575
- let s = i + offset,
576
- j = s
569
+ var s = i + offset
570
+ , j = s;
577
571
 
578
- while (data[j]) {
579
- j++
580
- }
572
+ while (data[j]) j++;
581
573
 
582
- assert(j < data.length)
574
+ assert(j < data.length);
583
575
 
584
576
  // Find out where the string table ends by
585
577
  // getting the highest string length.
586
578
  if (high < j - i) {
587
- high = j - i
579
+ high = j - i;
588
580
  }
589
581
 
590
- _strings[k] = data.toString('ascii', s, j)
591
- })
582
+ _strings[k] = data.toString('ascii', s, j);
583
+ });
592
584
 
593
585
  // Symbol Table
594
586
  // Add one to the highest string length because we didn't count \0.
595
- i += high + 1
596
- l = data.length
587
+ i += high + 1;
588
+ l = data.length;
597
589
 
598
- let sym = [],
599
- j
590
+ var sym = []
591
+ , j;
600
592
 
601
593
  for (; i < l; i++) {
602
- j = i
603
- while (data[j]) {
604
- j++
605
- }
606
- sym.push(data.toString('ascii', i, j))
607
- i = j
594
+ j = i;
595
+ while (data[j]) j++;
596
+ sym.push(data.toString('ascii', i, j));
597
+ i = j;
608
598
  }
609
599
 
610
600
  // Identify by name
611
- j = 0
601
+ j = 0;
612
602
 
613
- info.bools = {}
614
- _bools.forEach(function (bool) {
615
- info.bools[sym[j++]] = bool
616
- })
603
+ info.bools = {};
604
+ _bools.forEach(function(bool) {
605
+ info.bools[sym[j++]] = bool;
606
+ });
617
607
 
618
- info.numbers = {}
619
- _numbers.forEach(function (number) {
620
- info.numbers[sym[j++]] = number
621
- })
608
+ info.numbers = {};
609
+ _numbers.forEach(function(number) {
610
+ info.numbers[sym[j++]] = number;
611
+ });
622
612
 
623
- info.strings = {}
624
- _strings.forEach(function (string) {
625
- info.strings[sym[j++]] = string
626
- })
613
+ info.strings = {};
614
+ _strings.forEach(function(string) {
615
+ info.strings[sym[j++]] = string;
616
+ });
627
617
 
628
618
  // Should be the very last bit of data.
629
- assert.equal(i, data.length)
619
+ assert.equal(i, data.length);
630
620
 
631
- return info
632
- }
621
+ return info;
622
+ };
633
623
 
634
- Tput.prototype.compileTerminfo = function (term) {
635
- return this.compile(this.readTerminfo(term))
636
- }
624
+ Tput.prototype.compileTerminfo = function(term) {
625
+ return this.compile(this.readTerminfo(term));
626
+ };
637
627
 
638
- Tput.prototype.injectTerminfo = function (term) {
639
- return this.inject(this.compileTerminfo(term))
640
- }
628
+ Tput.prototype.injectTerminfo = function(term) {
629
+ return this.inject(this.compileTerminfo(term));
630
+ };
641
631
 
642
632
  /**
643
633
  * Compiler - terminfo cap->javascript
644
634
  */
645
635
 
646
- Tput.prototype.compile = function (info) {
647
- const self = this
636
+ Tput.prototype.compile = function(info) {
637
+ var self = this;
648
638
 
649
639
  if (!info) {
650
- throw new Error('Terminal not found.')
640
+ throw new Error('Terminal not found.');
651
641
  }
652
642
 
653
- this.detectFeatures(info)
643
+ this.detectFeatures(info);
654
644
 
655
- this._debug(info)
645
+ this._debug(info);
656
646
 
657
- info.all = {}
658
- info.methods = {}
647
+ info.all = {};
648
+ info.methods = {};
659
649
 
660
- ;['bools', 'numbers', 'strings'].forEach(function (type) {
661
- Object.keys(info[type]).forEach(function (key) {
662
- info.all[key] = info[type][key]
663
- info.methods[key] = self._compile(info, key, info.all[key])
664
- })
665
- })
650
+ ['bools', 'numbers', 'strings'].forEach(function(type) {
651
+ Object.keys(info[type]).forEach(function(key) {
652
+ info.all[key] = info[type][key];
653
+ info.methods[key] = self._compile(info, key, info.all[key]);
654
+ });
655
+ });
666
656
 
667
- Tput.bools.forEach(function (key) {
668
- if (info.methods[key] == null) {
669
- info.methods[key] = false
670
- }
671
- })
657
+ Tput.bools.forEach(function(key) {
658
+ if (info.methods[key] == null) info.methods[key] = false;
659
+ });
672
660
 
673
- Tput.numbers.forEach(function (key) {
674
- if (info.methods[key] == null) {
675
- info.methods[key] = -1
676
- }
677
- })
661
+ Tput.numbers.forEach(function(key) {
662
+ if (info.methods[key] == null) info.methods[key] = -1;
663
+ });
678
664
 
679
- Tput.strings.forEach(function (key) {
680
- if (!info.methods[key]) {
681
- info.methods[key] = noop
682
- }
683
- })
665
+ Tput.strings.forEach(function(key) {
666
+ if (!info.methods[key]) info.methods[key] = noop;
667
+ });
684
668
 
685
- Object.keys(info.methods).forEach(function (key) {
686
- if (!Tput.alias[key]) {
687
- return
688
- }
689
- Tput.alias[key].forEach(function (alias) {
690
- info.methods[alias] = info.methods[key]
691
- })
669
+ Object.keys(info.methods).forEach(function(key) {
670
+ if (!Tput.alias[key]) return;
671
+ Tput.alias[key].forEach(function(alias) {
672
+ info.methods[alias] = info.methods[key];
673
+ });
692
674
  // Could just use:
693
675
  // Object.keys(Tput.aliasMap).forEach(function(key) {
694
676
  // info.methods[key] = info.methods[Tput.aliasMap[key]];
695
677
  // });
696
- })
678
+ });
697
679
 
698
- return info
699
- }
680
+ return info;
681
+ };
700
682
 
701
- Tput.prototype.inject = function (info) {
702
- const self = this,
703
- methods = info.methods || info
683
+ Tput.prototype.inject = function(info) {
684
+ var self = this
685
+ , methods = info.methods || info;
704
686
 
705
- Object.keys(methods).forEach(function (key) {
687
+ Object.keys(methods).forEach(function(key) {
706
688
  if (typeof methods[key] !== 'function') {
707
- self[key] = methods[key]
708
- return
709
- }
710
- self[key] = function () {
711
- const args = Array.prototype.slice.call(arguments)
712
- return methods[key].call(self, args)
713
- }
714
- })
715
-
716
- this.info = info
717
- this.all = info.all
718
- this.methods = info.methods
719
- this.bools = info.bools
720
- this.numbers = info.numbers
721
- this.strings = info.strings
689
+ self[key] = methods[key];
690
+ return;
691
+ }
692
+ self[key] = function() {
693
+ var args = Array.prototype.slice.call(arguments);
694
+ return methods[key].call(self, args);
695
+ };
696
+ });
697
+
698
+ this.info = info;
699
+ this.all = info.all;
700
+ this.methods = info.methods;
701
+ this.bools = info.bools;
702
+ this.numbers = info.numbers;
703
+ this.strings = info.strings;
722
704
 
723
705
  if (!~info.names.indexOf(this.terminal)) {
724
- this.terminal = info.name
706
+ this.terminal = info.name;
725
707
  }
726
708
 
727
- this.features = info.features
728
- Object.keys(info.features).forEach(function (key) {
709
+ this.features = info.features;
710
+ Object.keys(info.features).forEach(function(key) {
729
711
  if (key === 'padding') {
730
712
  if (!info.features.padding && self.options.padding !== true) {
731
- self.padding = false
713
+ self.padding = false;
732
714
  }
733
- return
715
+ return;
734
716
  }
735
- self[key] = info.features[key]
736
- })
737
- }
717
+ self[key] = info.features[key];
718
+ });
719
+ };
738
720
 
739
721
  // See:
740
722
  // ~/ncurses/ncurses/tinfo/lib_tparm.c
741
723
  // ~/ncurses/ncurses/tinfo/comp_scan.c
742
- Tput.prototype._compile = function (info, key, str) {
743
- let v
724
+ Tput.prototype._compile = function(info, key, str) {
725
+ var v;
744
726
 
745
- this._debug('Compiling %s: %s', key, JSON.stringify(str))
727
+ this._debug('Compiling %s: %s', key, JSON.stringify(str));
746
728
 
747
729
  switch (typeof str) {
748
730
  case 'boolean':
749
- return str
731
+ return str;
750
732
  case 'number':
751
- return str
733
+ return str;
752
734
  case 'string':
753
- break
735
+ break;
754
736
  default:
755
- return noop
737
+ return noop;
756
738
  }
757
739
 
758
740
  if (!str) {
759
- return noop
741
+ return noop;
760
742
  }
761
743
 
762
744
  // See:
@@ -764,183 +746,171 @@ Tput.prototype._compile = function (info, key, str) {
764
746
  // ~/ncurses/progs/tset.c - set_init() - L992
765
747
  if (key === 'init_file' || key === 'reset_file') {
766
748
  try {
767
- str = fs.readFileSync(str, 'utf8')
749
+ str = fs.readFileSync(str, 'utf8');
768
750
  if (this.debug) {
769
751
  v = ('return ' + JSON.stringify(str) + ';')
770
752
  .replace(/\x1b/g, '\\x1b')
771
753
  .replace(/\r/g, '\\r')
772
- .replace(/\n/g, '\\n')
773
- process.stdout.write(v + '\n')
774
- }
775
- return function () {
776
- return str
754
+ .replace(/\n/g, '\\n');
755
+ process.stdout.write(v + '\n');
777
756
  }
757
+ return function() { return str; };
778
758
  } catch (e) {
779
- return noop
759
+ return noop;
780
760
  }
781
761
  }
782
762
 
783
- let tkey = info.name + '.' + key,
784
- header = 'var v, dyn = {}, stat = {}, stack = [], out = [];',
785
- footer = ';return out.join("");',
786
- code = header,
787
- val = str,
788
- buff = '',
789
- cap,
790
- ch,
791
- fi,
792
- then,
793
- els,
794
- end
763
+ var tkey = info.name + '.' + key
764
+ , header = 'var v, dyn = {}, stat = {}, stack = [], out = [];'
765
+ , footer = ';return out.join("");'
766
+ , code = header
767
+ , val = str
768
+ , buff = ''
769
+ , cap
770
+ , ch
771
+ , fi
772
+ , then
773
+ , els
774
+ , end;
795
775
 
796
776
  function read(regex, no) {
797
- cap = regex.exec(val)
798
- if (!cap) {
799
- return
800
- }
801
- val = val.substring(cap[0].length)
802
- ch = cap[1]
803
- if (!no) {
804
- clear()
805
- }
806
- return cap
777
+ cap = regex.exec(val);
778
+ if (!cap) return;
779
+ val = val.substring(cap[0].length);
780
+ ch = cap[1];
781
+ if (!no) clear();
782
+ return cap;
807
783
  }
808
784
 
809
785
  function stmt(c) {
810
786
  if (code[code.length - 1] === ',') {
811
- code = code.slice(0, -1)
787
+ code = code.slice(0, -1);
812
788
  }
813
- code += c
789
+ code += c;
814
790
  }
815
791
 
816
792
  function expr(c) {
817
- code += c + ','
793
+ code += c + ',';
818
794
  }
819
795
 
820
796
  function echo(c) {
821
- if (c === '""') {
822
- return
823
- }
824
- expr('out.push(' + c + ')')
797
+ if (c === '""') return;
798
+ expr('out.push(' + c + ')');
825
799
  }
826
800
 
827
801
  function print(c) {
828
- buff += c
802
+ buff += c;
829
803
  }
830
804
 
831
805
  function clear() {
832
806
  if (buff) {
833
- echo(JSON.stringify(buff).replace(/\\u00([0-9a-fA-F]{2})/g, '\\x$1'))
834
- buff = ''
807
+ echo(JSON.stringify(buff).replace(/\\u00([0-9a-fA-F]{2})/g, '\\x$1'));
808
+ buff = '';
835
809
  }
836
810
  }
837
811
 
838
812
  while (val) {
839
813
  // Ignore newlines
840
814
  if (read(/^\n /, true)) {
841
- continue
815
+ continue;
842
816
  }
843
817
 
844
818
  // '^A' -> ^A
845
819
  if (read(/^\^(.)/i, true)) {
846
820
  if (!(ch >= ' ' && ch <= '~')) {
847
- this._debug('%s: bad caret char.', tkey)
821
+ this._debug('%s: bad caret char.', tkey);
848
822
  // NOTE: ncurses appears to simply
849
823
  // continue in this situation, but
850
824
  // I could be wrong.
851
- print(cap[0])
852
- continue
825
+ print(cap[0]);
826
+ continue;
853
827
  }
854
828
  if (ch === '?') {
855
- ch = '\x7f'
829
+ ch = '\x7f';
856
830
  } else {
857
- ch = ch.charCodeAt(0) & 31
858
- if (ch === 0) {
859
- ch = 128
860
- }
861
- ch = String.fromCharCode(ch)
831
+ ch = ch.charCodeAt(0) & 31;
832
+ if (ch === 0) ch = 128;
833
+ ch = String.fromCharCode(ch);
862
834
  }
863
- print(ch)
864
- continue
835
+ print(ch);
836
+ continue;
865
837
  }
866
838
 
867
839
  // 3 octal digits -> character
868
840
  if (read(/^\\([0-7]{3})/, true)) {
869
- print(String.fromCharCode(parseInt(ch, 8)))
870
- continue
841
+ print(String.fromCharCode(parseInt(ch, 8)));
842
+ continue;
871
843
  }
872
844
 
873
845
  // '\e' -> ^[
874
846
  // '\n' -> \n
875
847
  // '\r' -> \r
876
848
  // '\0' -> \x80 (special case)
877
- if (read(/^\\([eEnlrtbfs^\\,:0]|.)/, true)) {
849
+ if (read(/^\\([eEnlrtbfs\^\\,:0]|.)/, true)) {
878
850
  switch (ch) {
879
851
  case 'e':
880
852
  case 'E':
881
- ch = '\x1b'
882
- break
853
+ ch = '\x1b';
854
+ break;
883
855
  case 'n':
884
- ch = '\n'
885
- break
856
+ ch = '\n';
857
+ break;
886
858
  case 'l':
887
- ch = '\x85'
888
- break
859
+ ch = '\x85';
860
+ break;
889
861
  case 'r':
890
- ch = '\r'
891
- break
862
+ ch = '\r';
863
+ break;
892
864
  case 't':
893
- ch = '\t'
894
- break
865
+ ch = '\t';
866
+ break;
895
867
  case 'b':
896
- ch = '\x08'
897
- break
868
+ ch = '\x08';
869
+ break;
898
870
  case 'f':
899
- ch = '\x0c'
900
- break
871
+ ch = '\x0c';
872
+ break;
901
873
  case 's':
902
- ch = ' '
903
- break
874
+ ch = ' ';
875
+ break;
904
876
  case '^':
905
- ch = '^'
906
- break
877
+ ch = '^';
878
+ break;
907
879
  case '\\':
908
- ch = '\\'
909
- break
880
+ ch = '\\';
881
+ break;
910
882
  case ',':
911
- ch = ','
912
- break
883
+ ch = ',';
884
+ break;
913
885
  case ':':
914
- ch = ':'
915
- break
886
+ ch = ':';
887
+ break;
916
888
  case '0':
917
- ch = '\x80'
918
- break
889
+ ch = '\x80';
890
+ break;
919
891
  case 'a':
920
- ch = '\x07'
921
- break
892
+ ch = '\x07';
893
+ break;
922
894
  default:
923
- this._debug('%s: bad backslash char.', tkey)
924
- ch = cap[0]
925
- break
895
+ this._debug('%s: bad backslash char.', tkey);
896
+ ch = cap[0];
897
+ break;
926
898
  }
927
- print(ch)
928
- continue
899
+ print(ch);
900
+ continue;
929
901
  }
930
902
 
931
903
  // $<5> -> padding
932
904
  // e.g. flash_screen: '\u001b[?5h$<100/>\u001b[?5l',
933
- if (read(/^\$<(\d+)([*/]{0,2})>/, true)) {
934
- if (this.padding) {
935
- print(cap[0])
936
- }
937
- continue
905
+ if (read(/^\$<(\d+)([*\/]{0,2})>/, true)) {
906
+ if (this.padding) print(cap[0]);
907
+ continue;
938
908
  }
939
909
 
940
910
  // %% outputs `%'
941
911
  if (read(/^%%/, true)) {
942
- print('%')
943
- continue
912
+ print('%');
913
+ continue;
944
914
  }
945
915
 
946
916
  // %[[:]flags][width[.precision]][doxXs]
@@ -955,44 +925,42 @@ Tput.prototype._compile = function (info, key, str) {
955
925
  // %s print pop() like %s in printf
956
926
  if (read(/^%((?::-|[+# ]){1,4})?(\d+(?:\.\d+)?)?([doxXsc])/)) {
957
927
  if (this.printf || cap[1] || cap[2] || ~'oxX'.indexOf(cap[3])) {
958
- echo('sprintf("' + cap[0].replace(':-', '-') + '", stack.pop())')
928
+ echo('sprintf("'+ cap[0].replace(':-', '-') + '", stack.pop())');
959
929
  } else if (cap[3] === 'c') {
960
- echo(
961
- '(v = stack.pop(), isFinite(v) ' +
962
- '? String.fromCharCode(v || 0200) : "")'
963
- )
930
+ echo('(v = stack.pop(), isFinite(v) '
931
+ + '? String.fromCharCode(v || 0200) : "")');
964
932
  } else {
965
- echo('stack.pop()')
933
+ echo('stack.pop()');
966
934
  }
967
- continue
935
+ continue;
968
936
  }
969
937
 
970
938
  // %p[1-9]
971
939
  // push i'th parameter
972
940
  if (read(/^%p([1-9])/)) {
973
- expr('(stack.push(v = params[' + (ch - 1) + ']), v)')
974
- continue
941
+ expr('(stack.push(v = params[' + (ch - 1) + ']), v)');
942
+ continue;
975
943
  }
976
944
 
977
945
  // %P[a-z]
978
946
  // set dynamic variable [a-z] to pop()
979
947
  if (read(/^%P([a-z])/)) {
980
- expr('dyn.' + ch + ' = stack.pop()')
981
- continue
948
+ expr('dyn.' + ch + ' = stack.pop()');
949
+ continue;
982
950
  }
983
951
 
984
952
  // %g[a-z]
985
953
  // get dynamic variable [a-z] and push it
986
954
  if (read(/^%g([a-z])/)) {
987
- expr('(stack.push(dyn.' + ch + '), dyn.' + ch + ')')
988
- continue
955
+ expr('(stack.push(dyn.' + ch + '), dyn.' + ch + ')');
956
+ continue;
989
957
  }
990
958
 
991
959
  // %P[A-Z]
992
960
  // set static variable [a-z] to pop()
993
961
  if (read(/^%P([A-Z])/)) {
994
- expr('stat.' + ch + ' = stack.pop()')
995
- continue
962
+ expr('stat.' + ch + ' = stack.pop()');
963
+ continue;
996
964
  }
997
965
 
998
966
  // %g[A-Z]
@@ -1003,29 +971,29 @@ Tput.prototype._compile = function (info, key, str) {
1003
971
  // documented in other implementations. Relying on it will adversely
1004
972
  // impact portability to other implementations.
1005
973
  if (read(/^%g([A-Z])/)) {
1006
- expr('(stack.push(v = stat.' + ch + '), v)')
1007
- continue
974
+ expr('(stack.push(v = stat.' + ch + '), v)');
975
+ continue;
1008
976
  }
1009
977
 
1010
978
  // %'c' char constant c
1011
979
  // NOTE: These are stored as c chars, exemplified by:
1012
980
  // cursor_address: "\u001b=%p1%' '%+%c%p2%' '%+%c"
1013
981
  if (read(/^%'(.)'/)) {
1014
- expr('(stack.push(v = ' + ch.charCodeAt(0) + '), v)')
1015
- continue
982
+ expr('(stack.push(v = ' + ch.charCodeAt(0) + '), v)');
983
+ continue;
1016
984
  }
1017
985
 
1018
986
  // %{nn}
1019
987
  // integer constant nn
1020
988
  if (read(/^%\{(\d+)\}/)) {
1021
- expr('(stack.push(v = ' + ch + '), v)')
1022
- continue
989
+ expr('(stack.push(v = ' + ch + '), v)');
990
+ continue;
1023
991
  }
1024
992
 
1025
993
  // %l push strlen(pop)
1026
994
  if (read(/^%l/)) {
1027
- expr('(stack.push(v = (stack.pop() || "").length || 0), v)')
1028
- continue
995
+ expr('(stack.push(v = (stack.pop() || "").length || 0), v)');
996
+ continue;
1029
997
  }
1030
998
 
1031
999
  // %+ %- %* %/ %m
@@ -1034,39 +1002,30 @@ Tput.prototype._compile = function (info, key, str) {
1034
1002
  // bit operations (AND, OR and exclusive-OR): push(pop() op pop())
1035
1003
  // %= %> %<
1036
1004
  // logical operations: push(pop() op pop())
1037
- if (read(/^%([+\-*/m&|^=><])/)) {
1038
- if (ch === '=') {
1039
- ch = '==='
1040
- } else if (ch === 'm') {
1041
- ch = '%'
1042
- }
1043
- expr(
1044
- '(v = stack.pop(),' +
1045
- ' stack.push(v = (stack.pop() ' +
1046
- ch +
1047
- ' v) || 0),' +
1048
- ' v)'
1049
- )
1050
- continue
1005
+ if (read(/^%([+\-*\/m&|\^=><])/)) {
1006
+ if (ch === '=') ch = '===';
1007
+ else if (ch === 'm') ch = '%';
1008
+ expr('(v = stack.pop(),'
1009
+ + ' stack.push(v = (stack.pop() ' + ch + ' v) || 0),'
1010
+ + ' v)');
1011
+ continue;
1051
1012
  }
1052
1013
 
1053
1014
  // %A, %O
1054
1015
  // logical AND and OR operations (for conditionals)
1055
1016
  if (read(/^%([AO])/)) {
1056
1017
  // Are we supposed to store the result on the stack?
1057
- expr(
1058
- '(stack.push(v = (stack.pop() ' +
1059
- (ch === 'A' ? '&&' : '||') +
1060
- ' stack.pop())), v)'
1061
- )
1062
- continue
1018
+ expr('(stack.push(v = (stack.pop() '
1019
+ + (ch === 'A' ? '&&' : '||')
1020
+ + ' stack.pop())), v)');
1021
+ continue;
1063
1022
  }
1064
1023
 
1065
1024
  // %! %~
1066
1025
  // unary operations (logical and bit complement): push(op pop())
1067
1026
  if (read(/^%([!~])/)) {
1068
- expr('(stack.push(v = ' + ch + 'stack.pop()), v)')
1069
- continue
1027
+ expr('(stack.push(v = ' + ch + 'stack.pop()), v)');
1028
+ continue;
1070
1029
  }
1071
1030
 
1072
1031
  // %i add 1 to first two parameters (for ANSI terminals)
@@ -1077,8 +1036,8 @@ Tput.prototype._compile = function (info, key, str) {
1077
1036
  // just be a bad terminfo string.
1078
1037
  // user6: "\u001b[%i%d;%dR" - possibly a termcap-style string.
1079
1038
  // expr('(params[0] |= 0, params[1] |= 0, params[0]++, params[1]++)');
1080
- expr('(params[0]++, params[1]++)')
1081
- continue
1039
+ expr('(params[0]++, params[1]++)');
1040
+ continue;
1082
1041
  }
1083
1042
 
1084
1043
  // %? expr %t thenpart %e elsepart %;
@@ -1090,13 +1049,13 @@ Tput.prototype._compile = function (info, key, str) {
1090
1049
  // %? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4 %t b4 %e %;
1091
1050
  // where ci are conditions, bi are bodies.
1092
1051
  if (read(/^%\?/)) {
1093
- end = -1
1094
- stmt(';if (')
1095
- continue
1052
+ end = -1;
1053
+ stmt(';if (');
1054
+ continue;
1096
1055
  }
1097
1056
 
1098
1057
  if (read(/^%t/)) {
1099
- end = -1
1058
+ end = -1;
1100
1059
  // Technically this is supposed to pop everything off the stack that was
1101
1060
  // pushed onto the stack after the if statement, see man terminfo.
1102
1061
  // Right now, we don't pop anything off. This could cause compat issues.
@@ -1104,165 +1063,150 @@ Tput.prototype._compile = function (info, key, str) {
1104
1063
  // is added, to the time the then statement is added, and pop off
1105
1064
  // the appropriate number of elements.
1106
1065
  // while (pushed--) expr('stack.pop()');
1107
- stmt(') {')
1108
- continue
1066
+ stmt(') {');
1067
+ continue;
1109
1068
  }
1110
1069
 
1111
1070
  // Terminfo does elseif's like
1112
1071
  // this: %?[expr]%t...%e[expr]%t...%;
1113
1072
  if (read(/^%e/)) {
1114
- fi = val.indexOf('%?')
1115
- then = val.indexOf('%t')
1116
- els = val.indexOf('%e')
1117
- end = val.indexOf('%;')
1118
- if (end === -1) {
1119
- end = Infinity
1120
- }
1121
- if (
1122
- then !== -1 &&
1123
- then < end &&
1124
- (fi === -1 || then < fi) &&
1125
- (els === -1 || then < els)
1126
- ) {
1127
- stmt('} else if (')
1073
+ fi = val.indexOf('%?');
1074
+ then = val.indexOf('%t');
1075
+ els = val.indexOf('%e');
1076
+ end = val.indexOf('%;');
1077
+ if (end === -1) end = Infinity;
1078
+ if (then !== -1 && then < end
1079
+ && (fi === -1 || then < fi)
1080
+ && (els === -1 || then < els)) {
1081
+ stmt('} else if (');
1128
1082
  } else {
1129
- stmt('} else {')
1083
+ stmt('} else {');
1130
1084
  }
1131
- continue
1085
+ continue;
1132
1086
  }
1133
1087
 
1134
1088
  if (read(/^%;/)) {
1135
- end = null
1136
- stmt('}')
1137
- continue
1089
+ end = null;
1090
+ stmt('}');
1091
+ continue;
1138
1092
  }
1139
1093
 
1140
- buff += val[0]
1141
- val = val.substring(1)
1094
+ buff += val[0];
1095
+ val = val.substring(1);
1142
1096
  }
1143
1097
 
1144
1098
  // Clear the buffer of any remaining text.
1145
- clear()
1099
+ clear();
1146
1100
 
1147
1101
  // Some terminfos (I'm looking at you, atari-color), don't end an if
1148
1102
  // statement. It's assumed terminfo will automatically end it for
1149
1103
  // them, because they are a bunch of lazy bastards.
1150
1104
  if (end != null) {
1151
- stmt('}')
1105
+ stmt('}');
1152
1106
  }
1153
1107
 
1154
1108
  // Add the footer.
1155
- stmt(footer)
1109
+ stmt(footer);
1156
1110
 
1157
1111
  // Optimize and cleanup generated code.
1158
- v = code.slice(header.length, -footer.length)
1112
+ v = code.slice(header.length, -footer.length);
1159
1113
  if (!v.length) {
1160
- code = 'return "";'
1161
- } else if ((v = /^out\.push\(("(?:[^"]|\\")+")\)$/.exec(v))) {
1162
- code = 'return ' + v[1] + ';'
1114
+ code = 'return "";';
1115
+ } else if (v = /^out\.push\(("(?:[^"]|\\")+")\)$/.exec(v)) {
1116
+ code = 'return ' + v[1] + ';';
1163
1117
  } else {
1164
1118
  // Turn `(stack.push(v = params[0]), v),out.push(stack.pop())`
1165
1119
  // into `out.push(params[0])`.
1166
1120
  code = code.replace(
1167
1121
  /\(stack\.push\(v = params\[(\d+)\]\), v\),out\.push\(stack\.pop\(\)\)/g,
1168
- 'out.push(params[$1])'
1169
- )
1122
+ 'out.push(params[$1])');
1170
1123
 
1171
1124
  // Remove unnecessary variable initializations.
1172
- v = code.slice(header.length, -footer.length)
1173
- if (!~v.indexOf('v = ')) {
1174
- code = code.replace('v, ', '')
1175
- }
1176
- if (!~v.indexOf('dyn')) {
1177
- code = code.replace('dyn = {}, ', '')
1178
- }
1179
- if (!~v.indexOf('stat')) {
1180
- code = code.replace('stat = {}, ', '')
1181
- }
1182
- if (!~v.indexOf('stack')) {
1183
- code = code.replace('stack = [], ', '')
1184
- }
1125
+ v = code.slice(header.length, -footer.length);
1126
+ if (!~v.indexOf('v = ')) code = code.replace('v, ', '');
1127
+ if (!~v.indexOf('dyn')) code = code.replace('dyn = {}, ', '');
1128
+ if (!~v.indexOf('stat')) code = code.replace('stat = {}, ', '');
1129
+ if (!~v.indexOf('stack')) code = code.replace('stack = [], ', '');
1185
1130
 
1186
1131
  // Turn `var out = [];out.push("foo"),` into `var out = ["foo"];`.
1187
1132
  code = code.replace(
1188
1133
  /out = \[\];out\.push\(("(?:[^"]|\\")+")\),/,
1189
- 'out = [$1];'
1190
- )
1134
+ 'out = [$1];');
1191
1135
  }
1192
1136
 
1193
1137
  // Terminfos `wyse350-vb`, and `wy350-w`
1194
1138
  // seem to have a few broken strings.
1195
1139
  if (str === '\u001b%?') {
1196
- code = 'return "\\x1b";'
1140
+ code = 'return "\\x1b";';
1197
1141
  }
1198
1142
 
1199
1143
  if (this.debug) {
1200
1144
  v = code
1201
1145
  .replace(/\x1b/g, '\\x1b')
1202
1146
  .replace(/\r/g, '\\r')
1203
- .replace(/\n/g, '\\n')
1204
- process.stdout.write(v + '\n')
1147
+ .replace(/\n/g, '\\n');
1148
+ process.stdout.write(v + '\n');
1205
1149
  }
1206
1150
 
1207
1151
  try {
1208
1152
  if (this.options.stringify && code.indexOf('return ') === 0) {
1209
- return new Function('', code)()
1153
+ return new Function('', code)();
1210
1154
  }
1211
1155
  return this.printf || ~code.indexOf('sprintf(')
1212
1156
  ? new Function('sprintf, params', code).bind(null, sprintf)
1213
- : new Function('params', code)
1157
+ : new Function('params', code);
1214
1158
  } catch (e) {
1215
- console.error('')
1216
- console.error('Error on %s:', tkey)
1217
- console.error(JSON.stringify(str))
1218
- console.error('')
1219
- console.error(code.replace(/(,|;)/g, '$1\n'))
1220
- e.stack = e.stack.replace(/\x1b/g, '\\x1b')
1221
- throw e
1159
+ console.error('');
1160
+ console.error('Error on %s:', tkey);
1161
+ console.error(JSON.stringify(str));
1162
+ console.error('');
1163
+ console.error(code.replace(/(,|;)/g, '$1\n'));
1164
+ e.stack = e.stack.replace(/\x1b/g, '\\x1b');
1165
+ throw e;
1222
1166
  }
1223
- }
1167
+ };
1224
1168
 
1225
1169
  // See: ~/ncurses/ncurses/tinfo/lib_tputs.c
1226
- Tput.prototype._print = function (code, print, done) {
1227
- const xon = !this.bools.needs_xon_xoff || this.bools.xon_xoff
1170
+ Tput.prototype._print = function(code, print, done) {
1171
+ var xon = !this.bools.needs_xon_xoff || this.bools.xon_xoff;
1228
1172
 
1229
- print = print || write
1230
- done = done || noop
1173
+ print = print || write;
1174
+ done = done || noop;
1231
1175
 
1232
1176
  if (!this.padding) {
1233
- print(code)
1234
- return done()
1177
+ print(code);
1178
+ return done();
1235
1179
  }
1236
1180
 
1237
- let parts = code.split(/(?=\$<[\d.]+[*/]{0,2}>)/),
1238
- i = 0
1181
+ var parts = code.split(/(?=\$<[\d.]+[*\/]{0,2}>)/)
1182
+ , i = 0;
1239
1183
 
1240
- ;(function next() {
1184
+ (function next() {
1241
1185
  if (i === parts.length) {
1242
- return done()
1186
+ return done();
1243
1187
  }
1244
1188
 
1245
- let part = parts[i++],
1246
- padding = /^\$<([\d.]+)([*/]{0,2})>/.exec(part),
1247
- amount,
1248
- suffix
1249
- // , affect;
1189
+ var part = parts[i++]
1190
+ , padding = /^\$<([\d.]+)([*\/]{0,2})>/.exec(part)
1191
+ , amount
1192
+ , suffix;
1193
+ // , affect;
1250
1194
 
1251
1195
  if (!padding) {
1252
- print(part)
1253
- return next()
1196
+ print(part);
1197
+ return next();
1254
1198
  }
1255
1199
 
1256
- part = part.substring(padding[0].length)
1257
- amount = +padding[1]
1258
- suffix = padding[2]
1200
+ part = part.substring(padding[0].length);
1201
+ amount = +padding[1];
1202
+ suffix = padding[2];
1259
1203
 
1260
1204
  // A `/' suffix indicates that the padding is mandatory and forces a
1261
1205
  // delay of the given number of milliseconds even on devices for which xon
1262
1206
  // is present to indicate flow control.
1263
1207
  if (xon && !~suffix.indexOf('/')) {
1264
- print(part)
1265
- return next()
1208
+ print(part);
1209
+ return next();
1266
1210
  }
1267
1211
 
1268
1212
  // A `*' indicates that the padding required is proportional to the number
@@ -1273,7 +1217,7 @@ Tput.prototype._print = function (code, print, done) {
1273
1217
  // computation but does not trigger delays.
1274
1218
  if (~suffix.indexOf('*')) {
1275
1219
  // XXX Disable this for now.
1276
- amount = amount
1220
+ amount = amount;
1277
1221
  // if (affect = /\x1b\[(\d+)[LM]/.exec(part)) {
1278
1222
  // amount *= +affect[1];
1279
1223
  // }
@@ -1288,22 +1232,22 @@ Tput.prototype._print = function (code, print, done) {
1288
1232
  // }
1289
1233
  }
1290
1234
 
1291
- return setTimeout(function () {
1292
- print(part)
1293
- return next()
1294
- }, amount)
1295
- })()
1296
- }
1235
+ return setTimeout(function() {
1236
+ print(part);
1237
+ return next();
1238
+ }, amount);
1239
+ })();
1240
+ };
1297
1241
 
1298
1242
  // A small helper function if we want
1299
1243
  // to easily output text with setTimeouts.
1300
- Tput.print = function () {
1301
- const fake = {
1244
+ Tput.print = function() {
1245
+ var fake = {
1302
1246
  padding: true,
1303
1247
  bools: { needs_xon_xoff: true, xon_xoff: false }
1304
- }
1305
- return Tput.prototype._print.apply(fake, arguments)
1306
- }
1248
+ };
1249
+ return Tput.prototype._print.apply(fake, arguments);
1250
+ };
1307
1251
 
1308
1252
  /**
1309
1253
  * Termcap
@@ -1315,110 +1259,109 @@ Tput.cpaths = [
1315
1259
  (process.env.HOME || '') + '/.termcap',
1316
1260
  '/usr/share/misc/termcap',
1317
1261
  '/etc/termcap'
1318
- ]
1262
+ ];
1319
1263
 
1320
- Tput.prototype.readTermcap = function (term) {
1321
- let self = this,
1322
- terms,
1323
- term_,
1324
- root,
1325
- paths
1264
+ Tput.prototype.readTermcap = function(term) {
1265
+ var self = this
1266
+ , terms
1267
+ , term_
1268
+ , root
1269
+ , paths;
1326
1270
 
1327
- term = term || this.terminal
1271
+ term = term || this.terminal;
1328
1272
 
1329
1273
  // Termcap has a bunch of terminals usually stored in one file/string,
1330
1274
  // so we need to find the one containing our desired terminal.
1331
1275
  if (~term.indexOf(path.sep) && (terms = this._tryCap(path.resolve(term)))) {
1332
- term_ = path.basename(term).split('.')[0]
1276
+ term_ = path.basename(term).split('.')[0];
1333
1277
  if (terms[process.env.TERM]) {
1334
- term = process.env.TERM
1278
+ term = process.env.TERM;
1335
1279
  } else if (terms[term_]) {
1336
- term = term_
1280
+ term = term_;
1337
1281
  } else {
1338
- term = Object.keys(terms)[0]
1282
+ term = Object.keys(terms)[0];
1339
1283
  }
1340
1284
  } else {
1341
- paths = Tput.cpaths.slice()
1285
+ paths = Tput.cpaths.slice();
1342
1286
 
1343
1287
  if (this.termcapFile) {
1344
- paths.unshift(this.termcapFile)
1288
+ paths.unshift(this.termcapFile);
1345
1289
  }
1346
1290
 
1347
- paths.push(Tput.termcap)
1291
+ paths.push(Tput.termcap);
1348
1292
 
1349
- terms = this._tryCap(paths, term)
1293
+ terms = this._tryCap(paths, term);
1350
1294
  }
1351
1295
 
1352
1296
  if (!terms) {
1353
- throw new Error('Cannot find termcap for: ' + term)
1297
+ throw new Error('Cannot find termcap for: ' + term);
1354
1298
  }
1355
1299
 
1356
- root = terms[term]
1300
+ root = terms[term];
1357
1301
 
1358
1302
  if (this.debug) {
1359
- this._termcap = terms
1303
+ this._termcap = terms;
1360
1304
  }
1361
1305
 
1362
- ;(function tc(term) {
1306
+ (function tc(term) {
1363
1307
  if (term && term.strings.tc) {
1364
- root.inherits = root.inherits || []
1365
- root.inherits.push(term.strings.tc)
1308
+ root.inherits = root.inherits || [];
1309
+ root.inherits.push(term.strings.tc);
1366
1310
 
1367
- const names = terms[term.strings.tc]
1311
+ var names = terms[term.strings.tc]
1368
1312
  ? terms[term.strings.tc].names
1369
- : [term.strings.tc]
1313
+ : [term.strings.tc];
1370
1314
 
1371
- self._debug('%s inherits from %s.', term.names.join('/'), names.join('/'))
1315
+ self._debug('%s inherits from %s.',
1316
+ term.names.join('/'), names.join('/'));
1372
1317
 
1373
- const inherit = tc(terms[term.strings.tc])
1318
+ var inherit = tc(terms[term.strings.tc]);
1374
1319
  if (inherit) {
1375
- ;['bools', 'numbers', 'strings'].forEach(function (type) {
1376
- merge(term[type], inherit[type])
1377
- })
1320
+ ['bools', 'numbers', 'strings'].forEach(function(type) {
1321
+ merge(term[type], inherit[type]);
1322
+ });
1378
1323
  }
1379
1324
  }
1380
- return term
1381
- })(root)
1325
+ return term;
1326
+ })(root);
1382
1327
 
1383
1328
  // Translate termcap names to terminfo-style names.
1384
- root = this.translateTermcap(root)
1329
+ root = this.translateTermcap(root);
1385
1330
 
1386
- return root
1387
- }
1331
+ return root;
1332
+ };
1388
1333
 
1389
- Tput.prototype._tryCap = function (file, term) {
1390
- if (!file) {
1391
- return
1392
- }
1334
+ Tput.prototype._tryCap = function(file, term) {
1335
+ if (!file) return;
1393
1336
 
1394
- let terms, data, i
1337
+ var terms
1338
+ , data
1339
+ , i;
1395
1340
 
1396
1341
  if (Array.isArray(file)) {
1397
1342
  for (i = 0; i < file.length; i++) {
1398
- data = this._tryCap(file[i], term)
1399
- if (data) {
1400
- return data
1401
- }
1343
+ data = this._tryCap(file[i], term);
1344
+ if (data) return data;
1402
1345
  }
1403
- return
1346
+ return;
1404
1347
  }
1405
1348
 
1406
1349
  // If the termcap string starts with `/`,
1407
1350
  // ncurses considers it a filename.
1408
- data = file[0] === '/' ? tryRead(file) : file
1351
+ data = file[0] === '/'
1352
+ ? tryRead(file)
1353
+ : file;
1409
1354
 
1410
- if (!data) {
1411
- return
1412
- }
1355
+ if (!data) return;
1413
1356
 
1414
- terms = this.parseTermcap(data, file)
1357
+ terms = this.parseTermcap(data, file);
1415
1358
 
1416
1359
  if (term && !terms[term]) {
1417
- return
1360
+ return;
1418
1361
  }
1419
1362
 
1420
- return terms
1421
- }
1363
+ return terms;
1364
+ };
1422
1365
 
1423
1366
  /**
1424
1367
  * Termcap Parser
@@ -1443,133 +1386,131 @@ Tput.prototype._tryCap = function (file, term) {
1443
1386
  // :sc=\E7:rc=\E8:cs=\E[%i%d;%dr:vs=\E[?7l:ve=\E[?7h:\
1444
1387
  // :mi:al=\E[L:dc=\E[P:dl=\E[M:ei=\E[4l:im=\E[4h:
1445
1388
 
1446
- Tput.prototype.parseTermcap = function (data, file) {
1447
- let terms = {},
1448
- parts,
1449
- term,
1450
- entries,
1451
- fields,
1452
- field,
1453
- names,
1454
- i,
1455
- j,
1456
- k
1389
+ Tput.prototype.parseTermcap = function(data, file) {
1390
+ var terms = {}
1391
+ , parts
1392
+ , term
1393
+ , entries
1394
+ , fields
1395
+ , field
1396
+ , names
1397
+ , i
1398
+ , j
1399
+ , k;
1457
1400
 
1458
1401
  // remove escaped newlines
1459
- data = data.replace(/\\\n[ \t]*/g, '')
1402
+ data = data.replace(/\\\n[ \t]*/g, '');
1460
1403
 
1461
1404
  // remove comments
1462
- data = data.replace(/^#[^\n]+/gm, '')
1405
+ data = data.replace(/^#[^\n]+/gm, '');
1463
1406
 
1464
1407
  // split entries
1465
- entries = data.trim().split(/\n+/)
1408
+ entries = data.trim().split(/\n+/);
1466
1409
 
1467
1410
  for (i = 0; i < entries.length; i++) {
1468
- fields = entries[i].split(/:+/)
1411
+ fields = entries[i].split(/:+/);
1469
1412
  for (j = 0; j < fields.length; j++) {
1470
- field = fields[j].trim()
1471
- if (!field) {
1472
- continue
1473
- }
1413
+ field = fields[j].trim();
1414
+ if (!field) continue;
1474
1415
 
1475
1416
  if (j === 0) {
1476
- names = field.split('|')
1417
+ names = field.split('|');
1477
1418
  term = {
1478
1419
  name: names[0],
1479
1420
  names: names,
1480
1421
  desc: names.pop(),
1481
- file: ~file.indexOf(path.sep) ? path.resolve(file) : file,
1422
+ file: ~file.indexOf(path.sep)
1423
+ ? path.resolve(file)
1424
+ : file,
1482
1425
  termcap: true
1483
- }
1426
+ };
1484
1427
 
1485
1428
  for (k = 0; k < names.length; k++) {
1486
- terms[names[k]] = term
1429
+ terms[names[k]] = term;
1487
1430
  }
1488
1431
 
1489
- term.bools = {}
1490
- term.numbers = {}
1491
- term.strings = {}
1432
+ term.bools = {};
1433
+ term.numbers = {};
1434
+ term.strings = {};
1492
1435
 
1493
- continue
1436
+ continue;
1494
1437
  }
1495
1438
 
1496
1439
  if (~field.indexOf('=')) {
1497
- parts = field.split('=')
1498
- term.strings[parts[0]] = parts.slice(1).join('=')
1440
+ parts = field.split('=');
1441
+ term.strings[parts[0]] = parts.slice(1).join('=');
1499
1442
  } else if (~field.indexOf('#')) {
1500
- parts = field.split('#')
1501
- term.numbers[parts[0]] = +parts.slice(1).join('#')
1443
+ parts = field.split('#');
1444
+ term.numbers[parts[0]] = +parts.slice(1).join('#');
1502
1445
  } else {
1503
- term.bools[field] = true
1446
+ term.bools[field] = true;
1504
1447
  }
1505
1448
  }
1506
1449
  }
1507
1450
 
1508
- return terms
1509
- }
1451
+ return terms;
1452
+ };
1510
1453
 
1511
1454
  /**
1512
1455
  * Termcap Compiler
1513
1456
  * man termcap
1514
1457
  */
1515
1458
 
1516
- Tput.prototype.translateTermcap = function (info) {
1517
- const self = this,
1518
- out = {}
1459
+ Tput.prototype.translateTermcap = function(info) {
1460
+ var self = this
1461
+ , out = {};
1519
1462
 
1520
- if (!info) {
1521
- return
1522
- }
1463
+ if (!info) return;
1523
1464
 
1524
- this._debug(info)
1465
+ this._debug(info);
1525
1466
 
1526
- ;['name', 'names', 'desc', 'file', 'termcap'].forEach(function (key) {
1527
- out[key] = info[key]
1528
- })
1467
+ ['name', 'names', 'desc', 'file', 'termcap'].forEach(function(key) {
1468
+ out[key] = info[key];
1469
+ });
1529
1470
 
1530
1471
  // Separate aliases for termcap
1531
- const map = (function () {
1532
- const out = {}
1472
+ var map = (function() {
1473
+ var out = {};
1533
1474
 
1534
- Object.keys(Tput.alias).forEach(function (key) {
1535
- const aliases = Tput.alias[key]
1536
- out[aliases.termcap] = key
1537
- })
1475
+ Object.keys(Tput.alias).forEach(function(key) {
1476
+ var aliases = Tput.alias[key];
1477
+ out[aliases.termcap] = key;
1478
+ });
1538
1479
 
1539
- return out
1540
- })()
1480
+ return out;
1481
+ })();
1541
1482
 
1542
1483
  // Translate termcap cap names to terminfo cap names.
1543
1484
  // e.g. `up` -> `cursor_up`
1544
- ;['bools', 'numbers', 'strings'].forEach(function (key) {
1545
- out[key] = {}
1546
- Object.keys(info[key]).forEach(function (cap) {
1485
+ ['bools', 'numbers', 'strings'].forEach(function(key) {
1486
+ out[key] = {};
1487
+ Object.keys(info[key]).forEach(function(cap) {
1547
1488
  if (key === 'strings') {
1548
- info.strings[cap] = self._captoinfo(cap, info.strings[cap], 1)
1489
+ info.strings[cap] = self._captoinfo(cap, info.strings[cap], 1);
1549
1490
  }
1550
1491
  if (map[cap]) {
1551
- out[key][map[cap]] = info[key][cap]
1492
+ out[key][map[cap]] = info[key][cap];
1552
1493
  } else {
1553
1494
  // NOTE: Possibly include all termcap names
1554
1495
  // in a separate alias.js file. Some are
1555
1496
  // missing from the terminfo alias.js file
1556
1497
  // which is why we have to do this:
1557
1498
  // See: $ man termcap
1558
- out[key][cap] = info[key][cap]
1499
+ out[key][cap] = info[key][cap];
1559
1500
  }
1560
- })
1561
- })
1501
+ });
1502
+ });
1562
1503
 
1563
- return out
1564
- }
1504
+ return out;
1505
+ };
1565
1506
 
1566
- Tput.prototype.compileTermcap = function (term) {
1567
- return this.compile(this.readTermcap(term))
1568
- }
1507
+ Tput.prototype.compileTermcap = function(term) {
1508
+ return this.compile(this.readTermcap(term));
1509
+ };
1569
1510
 
1570
- Tput.prototype.injectTermcap = function (term) {
1571
- return this.inject(this.compileTermcap(term))
1572
- }
1511
+ Tput.prototype.injectTermcap = function(term) {
1512
+ return this.inject(this.compileTermcap(term));
1513
+ };
1573
1514
 
1574
1515
  /**
1575
1516
  * _nc_captoinfo - ported to javascript directly from ncurses.
@@ -1584,159 +1525,156 @@ Tput.prototype.injectTermcap = function (term) {
1584
1525
  * pad translations if >=0
1585
1526
  */
1586
1527
 
1587
- Tput.prototype._captoinfo = function (cap, s, parameterized) {
1588
- const self = this
1528
+ Tput.prototype._captoinfo = function(cap, s, parameterized) {
1529
+ var self = this;
1589
1530
 
1590
- let capstart
1531
+ var capstart;
1591
1532
 
1592
1533
  if (parameterized == null) {
1593
- parameterized = 0
1534
+ parameterized = 0;
1594
1535
  }
1595
1536
 
1596
- const MAX_PUSHED = 16,
1597
- stack = []
1537
+ var MAX_PUSHED = 16
1538
+ , stack = [];
1598
1539
 
1599
- let stackptr = 0,
1600
- onstack = 0,
1601
- seenm = 0,
1602
- seenn = 0,
1603
- seenr = 0,
1604
- param = 1,
1605
- i = 0,
1606
- out = ''
1540
+ var stackptr = 0
1541
+ , onstack = 0
1542
+ , seenm = 0
1543
+ , seenn = 0
1544
+ , seenr = 0
1545
+ , param = 1
1546
+ , i = 0
1547
+ , out = '';
1607
1548
 
1608
1549
  function warn() {
1609
- const args = Array.prototype.slice.call(arguments)
1610
- args[0] = 'captoinfo: ' + (args[0] || '')
1611
- return self._debug.apply(self, args)
1550
+ var args = Array.prototype.slice.call(arguments);
1551
+ args[0] = 'captoinfo: ' + (args[0] || '');
1552
+ return self._debug.apply(self, args);
1612
1553
  }
1613
1554
 
1614
1555
  function isdigit(ch) {
1615
- return ch >= '0' && ch <= '9'
1556
+ return ch >= '0' && ch <= '9';
1616
1557
  }
1617
1558
 
1618
1559
  function isgraph(ch) {
1619
- return ch > ' ' && ch <= '~'
1560
+ return ch > ' ' && ch <= '~';
1620
1561
  }
1621
1562
 
1622
1563
  // convert a character to a terminfo push
1623
1564
  function cvtchar(sp) {
1624
- let c = '\0',
1625
- len
1565
+ var c = '\0'
1566
+ , len;
1626
1567
 
1627
- let j = i
1568
+ var j = i;
1628
1569
 
1629
1570
  switch (sp[j]) {
1630
1571
  case '\\':
1631
1572
  switch (sp[++j]) {
1632
- case "'":
1573
+ case '\'':
1633
1574
  case '$':
1634
1575
  case '\\':
1635
1576
  case '%':
1636
- c = sp[j]
1637
- len = 2
1638
- break
1577
+ c = sp[j];
1578
+ len = 2;
1579
+ break;
1639
1580
  case '\0':
1640
- c = '\\'
1641
- len = 1
1642
- break
1581
+ c = '\\';
1582
+ len = 1;
1583
+ break;
1643
1584
  case '0':
1644
1585
  case '1':
1645
1586
  case '2':
1646
1587
  case '3':
1647
- len = 1
1588
+ len = 1;
1648
1589
  while (isdigit(sp[j])) {
1649
- c = String.fromCharCode(
1650
- 8 * c.charCodeAt(0) +
1651
- (sp[j++].charCodeAt(0) - '0'.charCodeAt(0))
1652
- )
1653
- len++
1590
+ c = String.fromCharCode(8 * c.charCodeAt(0)
1591
+ + (sp[j++].charCodeAt(0) - '0'.charCodeAt(0)));
1592
+ len++;
1654
1593
  }
1655
- break
1594
+ break;
1656
1595
  default:
1657
- c = sp[j]
1658
- len = 2
1659
- break
1596
+ c = sp[j];
1597
+ len = 2;
1598
+ break;
1660
1599
  }
1661
- break
1600
+ break;
1662
1601
  case '^':
1663
- c = String.fromCharCode(sp[++j].charCodeAt(0) & 0x1f)
1664
- len = 2
1665
- break
1602
+ c = String.fromCharCode(sp[++j].charCodeAt(0) & 0x1f);
1603
+ len = 2;
1604
+ break;
1666
1605
  default:
1667
- c = sp[j]
1668
- len = 1
1606
+ c = sp[j];
1607
+ len = 1;
1669
1608
  }
1670
- if (isgraph(c) && c !== ',' && c !== "'" && c !== '\\' && c !== ':') {
1671
- out += "%'"
1672
- out += c
1673
- out += "'"
1609
+ if (isgraph(c) && c !== ',' && c !== '\'' && c !== '\\' && c !== ':') {
1610
+ out += '%\'';
1611
+ out += c;
1612
+ out += '\'';
1674
1613
  } else {
1675
- out += '%{'
1614
+ out += '%{';
1676
1615
  if (c.charCodeAt(0) > 99) {
1677
1616
  out += String.fromCharCode(
1678
- ((c.charCodeAt(0) / 100) | 0) + '0'.charCodeAt(0)
1679
- )
1617
+ (c.charCodeAt(0) / 100 | 0) + '0'.charCodeAt(0));
1680
1618
  }
1681
1619
  if (c.charCodeAt(0) > 9) {
1682
1620
  out += String.fromCharCode(
1683
- (((c.charCodeAt(0) / 10) | 0) % 10) + '0'.charCodeAt(0)
1684
- )
1621
+ (c.charCodeAt(0) / 10 | 0) % 10 + '0'.charCodeAt(0));
1685
1622
  }
1686
- out += String.fromCharCode((c.charCodeAt(0) % 10) + '0'.charCodeAt(0))
1687
- out += '}'
1623
+ out += String.fromCharCode(
1624
+ c.charCodeAt(0) % 10 + '0'.charCodeAt(0));
1625
+ out += '}';
1688
1626
  }
1689
1627
 
1690
- return len
1628
+ return len;
1691
1629
  }
1692
1630
 
1693
1631
  // push n copies of param on the terminfo stack if not already there
1694
1632
  function getparm(parm, n) {
1695
1633
  if (seenr) {
1696
1634
  if (parm === 1) {
1697
- parm = 2
1635
+ parm = 2;
1698
1636
  } else if (parm === 2) {
1699
- parm = 1
1637
+ parm = 1;
1700
1638
  }
1701
1639
  }
1702
1640
 
1703
1641
  if (onstack === parm) {
1704
1642
  if (n > 1) {
1705
- warn('string may not be optimal')
1706
- out += '%Pa'
1643
+ warn('string may not be optimal');
1644
+ out += '%Pa';
1707
1645
  while (n--) {
1708
- out += '%ga'
1646
+ out += '%ga';
1709
1647
  }
1710
1648
  }
1711
- return
1649
+ return;
1712
1650
  }
1713
1651
 
1714
1652
  if (onstack !== 0) {
1715
- push()
1653
+ push();
1716
1654
  }
1717
1655
 
1718
- onstack = parm
1656
+ onstack = parm;
1719
1657
 
1720
1658
  while (n--) {
1721
- out += '%p'
1722
- out += String.fromCharCode('0'.charCodeAt(0) + parm)
1659
+ out += '%p';
1660
+ out += String.fromCharCode('0'.charCodeAt(0) + parm);
1723
1661
  }
1724
1662
 
1725
1663
  if (seenn && parm < 3) {
1726
- out += '%{96}%^'
1664
+ out += '%{96}%^';
1727
1665
  }
1728
1666
 
1729
1667
  if (seenm && parm < 3) {
1730
- out += '%{127}%^'
1668
+ out += '%{127}%^';
1731
1669
  }
1732
1670
  }
1733
1671
 
1734
1672
  // push onstack on to the stack
1735
1673
  function push() {
1736
1674
  if (stackptr >= MAX_PUSHED) {
1737
- warn('string too complex to convert')
1675
+ warn('string too complex to convert');
1738
1676
  } else {
1739
- stack[stackptr++] = onstack
1677
+ stack[stackptr++] = onstack;
1740
1678
  }
1741
1679
  }
1742
1680
 
@@ -1744,43 +1682,37 @@ Tput.prototype._captoinfo = function (cap, s, parameterized) {
1744
1682
  function pop() {
1745
1683
  if (stackptr === 0) {
1746
1684
  if (onstack === 0) {
1747
- warn("I'm confused")
1685
+ warn('I\'m confused');
1748
1686
  } else {
1749
- onstack = 0
1687
+ onstack = 0;
1750
1688
  }
1751
1689
  } else {
1752
- onstack = stack[--stackptr]
1690
+ onstack = stack[--stackptr];
1753
1691
  }
1754
- param++
1692
+ param++;
1755
1693
  }
1756
1694
 
1757
1695
  function see03() {
1758
- getparm(param, 1)
1759
- out += '%3d'
1760
- pop()
1696
+ getparm(param, 1);
1697
+ out += '%3d';
1698
+ pop();
1761
1699
  }
1762
1700
 
1763
1701
  function invalid() {
1764
- out += '%'
1765
- i--
1766
- warn(
1767
- 'unknown %% code %s (%#x) in %s',
1768
- JSON.stringify(s[i]),
1769
- s[i].charCodeAt(0),
1770
- cap
1771
- )
1702
+ out += '%';
1703
+ i--;
1704
+ warn('unknown %% code %s (%#x) in %s',
1705
+ JSON.stringify(s[i]), s[i].charCodeAt(0), cap);
1772
1706
  }
1773
1707
 
1774
1708
  // skip the initial padding (if we haven't been told not to)
1775
- capstart = null
1776
- if (s == null) {
1777
- s = ''
1778
- }
1709
+ capstart = null;
1710
+ if (s == null) s = '';
1779
1711
 
1780
1712
  if (parameterized >= 0 && isdigit(s[i])) {
1781
- for (capstart = i; ; i++) {
1713
+ for (capstart = i;; i++) {
1782
1714
  if (!(isdigit(s[i]) || s[i] === '*' || s[i] === '.')) {
1783
- break
1715
+ break;
1784
1716
  }
1785
1717
  }
1786
1718
  }
@@ -1788,325 +1720,315 @@ Tput.prototype._captoinfo = function (cap, s, parameterized) {
1788
1720
  while (s[i]) {
1789
1721
  switch (s[i]) {
1790
1722
  case '%':
1791
- i++
1723
+ i++;
1792
1724
  if (parameterized < 1) {
1793
- out += '%'
1794
- break
1725
+ out += '%';
1726
+ break;
1795
1727
  }
1796
1728
  switch (s[i++]) {
1797
1729
  case '%':
1798
- out += '%'
1799
- break
1730
+ out += '%';
1731
+ break;
1800
1732
  case 'r':
1801
1733
  if (seenr++ === 1) {
1802
- warn('saw %%r twice in %s', cap)
1734
+ warn('saw %%r twice in %s', cap);
1803
1735
  }
1804
- break
1736
+ break;
1805
1737
  case 'm':
1806
1738
  if (seenm++ === 1) {
1807
- warn('saw %%m twice in %s', cap)
1739
+ warn('saw %%m twice in %s', cap);
1808
1740
  }
1809
- break
1741
+ break;
1810
1742
  case 'n':
1811
1743
  if (seenn++ === 1) {
1812
- warn('saw %%n twice in %s', cap)
1744
+ warn('saw %%n twice in %s', cap);
1813
1745
  }
1814
- break
1746
+ break;
1815
1747
  case 'i':
1816
- out += '%i'
1817
- break
1748
+ out += '%i';
1749
+ break;
1818
1750
  case '6':
1819
1751
  case 'B':
1820
- getparm(param, 1)
1821
- out += '%{10}%/%{16}%*'
1822
- getparm(param, 1)
1823
- out += '%{10}%m%+'
1824
- break
1752
+ getparm(param, 1);
1753
+ out += '%{10}%/%{16}%*';
1754
+ getparm(param, 1);
1755
+ out += '%{10}%m%+';
1756
+ break;
1825
1757
  case '8':
1826
1758
  case 'D':
1827
- getparm(param, 2)
1828
- out += '%{2}%*%-'
1829
- break
1759
+ getparm(param, 2);
1760
+ out += '%{2}%*%-';
1761
+ break;
1830
1762
  case '>':
1831
- getparm(param, 2)
1763
+ getparm(param, 2);
1832
1764
  // %?%{x}%>%t%{y}%+%;
1833
- out += '%?'
1834
- i += cvtchar(s)
1835
- out += '%>%t'
1836
- i += cvtchar(s)
1837
- out += '%+%;'
1838
- break
1765
+ out += '%?';
1766
+ i += cvtchar(s);
1767
+ out += '%>%t';
1768
+ i += cvtchar(s);
1769
+ out += '%+%;';
1770
+ break;
1839
1771
  case 'a':
1840
- if (
1841
- (s[i] === '=' ||
1842
- s[i] === '+' ||
1843
- s[i] === '-' ||
1844
- s[i] === '*' ||
1845
- s[i] === '/') &&
1846
- (s[i + 1] === 'p' || s[i + 1] === 'c') &&
1847
- s[i + 2] !== '\0' &&
1848
- s[i + 2]
1849
- ) {
1850
- let l
1851
- l = 2
1772
+ if ((s[i] === '=' || s[i] === '+' || s[i] === '-'
1773
+ || s[i] === '*' || s[i] === '/')
1774
+ && (s[i + 1] === 'p' || s[i + 1] === 'c')
1775
+ && s[i + 2] !== '\0' && s[i + 2]) {
1776
+ var l;
1777
+ l = 2;
1852
1778
  if (s[i] !== '=') {
1853
- getparm(param, 1)
1779
+ getparm(param, 1);
1854
1780
  }
1855
1781
  if (s[i + 1] === 'p') {
1856
- getparm(param + s[i + 2].charCodeAt(0) - '@'.charCodeAt(0), 1)
1782
+ getparm(param + s[i + 2].charCodeAt(0) - '@'.charCodeAt(0), 1);
1857
1783
  if (param !== onstack) {
1858
- pop()
1859
- param--
1784
+ pop();
1785
+ param--;
1860
1786
  }
1861
- l++
1787
+ l++;
1862
1788
  } else {
1863
- ;(i += 2), (l += cvtchar(s)), (i -= 2)
1789
+ i += 2, l += cvtchar(s), i -= 2;
1864
1790
  }
1865
1791
  switch (s[i]) {
1866
1792
  case '+':
1867
- out += '%+'
1868
- break
1793
+ out += '%+';
1794
+ break;
1869
1795
  case '-':
1870
- out += '%-'
1871
- break
1796
+ out += '%-';
1797
+ break;
1872
1798
  case '*':
1873
- out += '%*'
1874
- break
1799
+ out += '%*';
1800
+ break;
1875
1801
  case '/':
1876
- out += '%/'
1877
- break
1802
+ out += '%/';
1803
+ break;
1878
1804
  case '=':
1879
1805
  if (seenr) {
1880
1806
  if (param === 1) {
1881
- onstack = 2
1807
+ onstack = 2;
1882
1808
  } else if (param === 2) {
1883
- onstack = 1
1809
+ onstack = 1;
1884
1810
  } else {
1885
- onstack = param
1811
+ onstack = param;
1886
1812
  }
1887
1813
  } else {
1888
- onstack = param
1814
+ onstack = param;
1889
1815
  }
1890
- break
1816
+ break;
1891
1817
  }
1892
- i += l
1893
- break
1818
+ i += l;
1819
+ break;
1894
1820
  }
1895
- getparm(param, 1)
1896
- i += cvtchar(s)
1897
- out += '%+'
1898
- break
1821
+ getparm(param, 1);
1822
+ i += cvtchar(s);
1823
+ out += '%+';
1824
+ break;
1899
1825
  case '+':
1900
- getparm(param, 1)
1901
- i += cvtchar(s)
1902
- out += '%+%c'
1903
- pop()
1904
- break
1826
+ getparm(param, 1);
1827
+ i += cvtchar(s);
1828
+ out += '%+%c';
1829
+ pop();
1830
+ break;
1905
1831
  case 's':
1906
- // #ifdef WATERLOO
1907
- // i += cvtchar(s);
1908
- // getparm(param, 1);
1909
- // out += '%-';
1910
- // #else
1911
- getparm(param, 1)
1912
- out += '%s'
1913
- pop()
1914
- // #endif /* WATERLOO */
1915
- break
1832
+ // #ifdef WATERLOO
1833
+ // i += cvtchar(s);
1834
+ // getparm(param, 1);
1835
+ // out += '%-';
1836
+ // #else
1837
+ getparm(param, 1);
1838
+ out += '%s';
1839
+ pop();
1840
+ // #endif /* WATERLOO */
1841
+ break;
1916
1842
  case '-':
1917
- i += cvtchar(s)
1918
- getparm(param, 1)
1919
- out += '%-%c'
1920
- pop()
1921
- break
1843
+ i += cvtchar(s);
1844
+ getparm(param, 1);
1845
+ out += '%-%c';
1846
+ pop();
1847
+ break;
1922
1848
  case '.':
1923
- getparm(param, 1)
1924
- out += '%c'
1925
- pop()
1926
- break
1849
+ getparm(param, 1);
1850
+ out += '%c';
1851
+ pop();
1852
+ break;
1927
1853
  case '0': // not clear any of the historical termcaps did this
1928
1854
  if (s[i] === '3') {
1929
- see03() // goto
1930
- break
1855
+ see03(); // goto
1856
+ break;
1931
1857
  } else if (s[i] !== '2') {
1932
- invalid() // goto
1933
- break
1858
+ invalid(); // goto
1859
+ break;
1934
1860
  }
1935
- // FALLTHRU
1861
+ // FALLTHRU
1936
1862
  case '2':
1937
- getparm(param, 1)
1938
- out += '%2d'
1939
- pop()
1940
- break
1863
+ getparm(param, 1);
1864
+ out += '%2d';
1865
+ pop();
1866
+ break;
1941
1867
  case '3':
1942
- see03()
1943
- break
1868
+ see03();
1869
+ break;
1944
1870
  case 'd':
1945
- getparm(param, 1)
1946
- out += '%d'
1947
- pop()
1948
- break
1871
+ getparm(param, 1);
1872
+ out += '%d';
1873
+ pop();
1874
+ break;
1949
1875
  case 'f':
1950
- param++
1951
- break
1876
+ param++;
1877
+ break;
1952
1878
  case 'b':
1953
- param--
1954
- break
1879
+ param--;
1880
+ break;
1955
1881
  case '\\':
1956
- out += '%\\'
1957
- break
1882
+ out += '%\\';
1883
+ break;
1958
1884
  default:
1959
- invalid()
1960
- break
1885
+ invalid();
1886
+ break;
1961
1887
  }
1962
- break
1963
- // #ifdef REVISIBILIZE
1964
- // case '\\':
1965
- // out += s[i++];
1966
- // out += s[i++];
1967
- // break;
1968
- // case '\n':
1969
- // out += '\\n';
1970
- // i++;
1971
- // break;
1972
- // case '\t':
1973
- // out += '\\t';
1974
- // i++;
1975
- // break;
1976
- // case '\r':
1977
- // out += '\\r';
1978
- // i++;
1979
- // break;
1980
- // case '\x80':
1981
- // out += '\\0';
1982
- // i++;
1983
- // break;
1984
- // case '\f':
1985
- // out += '\\f';
1986
- // i++;
1987
- // break;
1988
- // case '\b':
1989
- // out += '\\b';
1990
- // i++;
1991
- // break;
1992
- // case ' ':
1993
- // out += '\\s';
1994
- // i++;
1995
- // break;
1996
- // case '^':
1997
- // out += '\\^';
1998
- // i++;
1999
- // break;
2000
- // case ':':
2001
- // out += '\\:';
2002
- // i++;
2003
- // break;
2004
- // case ',':
2005
- // out += '\\,';
2006
- // i++;
2007
- // break;
2008
- // default:
2009
- // if (s[i] === '\033') {
2010
- // out += '\\E';
2011
- // i++;
2012
- // } else if (s[i].charCodeAt(0) > 0 && s[i].charCodeAt(0) < 32) {
2013
- // out += '^';
2014
- // out += String.fromCharCode(s[i].charCodeAt(0) + '@'.charCodeAt(0));
2015
- // i++;
2016
- // } else if (s[i].charCodeAt(0) <= 0 || s[i].charCodeAt(0) >= 127) {
2017
- // out += '\\';
2018
- // out += String.fromCharCode(
2019
- // ((s[i].charCodeAt(0) & 0300) >> 6) + '0'.charCodeAt(0));
2020
- // out += String.fromCharCode(
2021
- // ((s[i].charCodeAt(0) & 0070) >> 3) + '0'.charCodeAt(0));
2022
- // out += String.fromCharCode(
2023
- // (s[i].charCodeAt(0) & 0007) + '0'.charCodeAt(0));
2024
- // i++;
2025
- // } else {
2026
- // out += s[i++];
2027
- // }
2028
- // break;
2029
- // #else
1888
+ break;
1889
+ // #ifdef REVISIBILIZE
1890
+ // case '\\':
1891
+ // out += s[i++];
1892
+ // out += s[i++];
1893
+ // break;
1894
+ // case '\n':
1895
+ // out += '\\n';
1896
+ // i++;
1897
+ // break;
1898
+ // case '\t':
1899
+ // out += '\\t';
1900
+ // i++;
1901
+ // break;
1902
+ // case '\r':
1903
+ // out += '\\r';
1904
+ // i++;
1905
+ // break;
1906
+ // case '\x80':
1907
+ // out += '\\0';
1908
+ // i++;
1909
+ // break;
1910
+ // case '\f':
1911
+ // out += '\\f';
1912
+ // i++;
1913
+ // break;
1914
+ // case '\b':
1915
+ // out += '\\b';
1916
+ // i++;
1917
+ // break;
1918
+ // case ' ':
1919
+ // out += '\\s';
1920
+ // i++;
1921
+ // break;
1922
+ // case '^':
1923
+ // out += '\\^';
1924
+ // i++;
1925
+ // break;
1926
+ // case ':':
1927
+ // out += '\\:';
1928
+ // i++;
1929
+ // break;
1930
+ // case ',':
1931
+ // out += '\\,';
1932
+ // i++;
1933
+ // break;
1934
+ // default:
1935
+ // if (s[i] === '\033') {
1936
+ // out += '\\E';
1937
+ // i++;
1938
+ // } else if (s[i].charCodeAt(0) > 0 && s[i].charCodeAt(0) < 32) {
1939
+ // out += '^';
1940
+ // out += String.fromCharCode(s[i].charCodeAt(0) + '@'.charCodeAt(0));
1941
+ // i++;
1942
+ // } else if (s[i].charCodeAt(0) <= 0 || s[i].charCodeAt(0) >= 127) {
1943
+ // out += '\\';
1944
+ // out += String.fromCharCode(
1945
+ // ((s[i].charCodeAt(0) & 0300) >> 6) + '0'.charCodeAt(0));
1946
+ // out += String.fromCharCode(
1947
+ // ((s[i].charCodeAt(0) & 0070) >> 3) + '0'.charCodeAt(0));
1948
+ // out += String.fromCharCode(
1949
+ // (s[i].charCodeAt(0) & 0007) + '0'.charCodeAt(0));
1950
+ // i++;
1951
+ // } else {
1952
+ // out += s[i++];
1953
+ // }
1954
+ // break;
1955
+ // #else
2030
1956
  default:
2031
- out += s[i++]
2032
- break
2033
- // #endif
1957
+ out += s[i++];
1958
+ break;
1959
+ // #endif
2034
1960
  }
2035
1961
  }
2036
1962
 
2037
1963
  // Now, if we stripped off some leading padding, add it at the end
2038
1964
  // of the string as mandatory padding.
2039
1965
  if (capstart != null) {
2040
- out += '$<'
2041
- for (i = capstart; ; i++) {
1966
+ out += '$<';
1967
+ for (i = capstart;; i++) {
2042
1968
  if (isdigit(s[i]) || s[i] === '*' || s[i] === '.') {
2043
- out += s[i]
1969
+ out += s[i];
2044
1970
  } else {
2045
- break
1971
+ break;
2046
1972
  }
2047
1973
  }
2048
- out += '/>'
1974
+ out += '/>';
2049
1975
  }
2050
1976
 
2051
1977
  if (s !== out) {
2052
- warn(
2053
- 'Translating %s from %s to %s.',
2054
- cap,
2055
- JSON.stringify(s),
2056
- JSON.stringify(out)
2057
- )
1978
+ warn('Translating %s from %s to %s.',
1979
+ cap, JSON.stringify(s), JSON.stringify(out));
2058
1980
  }
2059
1981
 
2060
- return out
2061
- }
1982
+ return out;
1983
+ };
2062
1984
 
2063
1985
  /**
2064
1986
  * Compile All Terminfo
2065
1987
  */
2066
1988
 
2067
- Tput.prototype.getAll = function () {
2068
- const dir = this._prefix(),
2069
- list = asort(fs.readdirSync(dir)),
2070
- infos = []
1989
+ Tput.prototype.getAll = function() {
1990
+ var dir = this._prefix()
1991
+ , list = asort(fs.readdirSync(dir))
1992
+ , infos = [];
2071
1993
 
2072
- list.forEach(function (letter) {
2073
- const terms = asort(fs.readdirSync(path.resolve(dir, letter)))
2074
- infos.push.apply(infos, terms)
2075
- })
1994
+ list.forEach(function(letter) {
1995
+ var terms = asort(fs.readdirSync(path.resolve(dir, letter)));
1996
+ infos.push.apply(infos, terms);
1997
+ });
2076
1998
 
2077
1999
  function asort(obj) {
2078
- return obj.sort(function (a, b) {
2079
- a = a.toLowerCase().charCodeAt(0)
2080
- b = b.toLowerCase().charCodeAt(0)
2081
- return a - b
2082
- })
2000
+ return obj.sort(function(a, b) {
2001
+ a = a.toLowerCase().charCodeAt(0);
2002
+ b = b.toLowerCase().charCodeAt(0);
2003
+ return a - b;
2004
+ });
2083
2005
  }
2084
2006
 
2085
- return infos
2086
- }
2007
+ return infos;
2008
+ };
2087
2009
 
2088
- Tput.prototype.compileAll = function (start) {
2089
- const self = this,
2090
- all = {}
2010
+ Tput.prototype.compileAll = function(start) {
2011
+ var self = this
2012
+ , all = {};
2091
2013
 
2092
- this.getAll().forEach(function (name) {
2014
+ this.getAll().forEach(function(name) {
2093
2015
  if (start && name !== start) {
2094
- return
2016
+ return;
2095
2017
  } else {
2096
- start = null
2018
+ start = null;
2097
2019
  }
2098
- all[name] = self.compileTerminfo(name)
2099
- })
2020
+ all[name] = self.compileTerminfo(name);
2021
+ });
2100
2022
 
2101
- return all
2102
- }
2023
+ return all;
2024
+ };
2103
2025
 
2104
2026
  /**
2105
2027
  * Detect Features / Quirks
2106
2028
  */
2107
2029
 
2108
- Tput.prototype.detectFeatures = function (info) {
2109
- const data = this.parseACS(info)
2030
+ Tput.prototype.detectFeatures = function(info) {
2031
+ var data = this.parseACS(info);
2110
2032
  info.features = {
2111
2033
  unicode: this.detectUnicode(info),
2112
2034
  brokenACS: this.detectBrokenACS(info),
@@ -2116,26 +2038,22 @@ Tput.prototype.detectFeatures = function (info) {
2116
2038
  setbuf: this.detectSetbuf(info),
2117
2039
  acsc: data.acsc,
2118
2040
  acscr: data.acscr
2119
- }
2120
- return info.features
2121
- }
2041
+ };
2042
+ return info.features;
2043
+ };
2122
2044
 
2123
- Tput.prototype.detectUnicode = function () {
2045
+ Tput.prototype.detectUnicode = function() {
2124
2046
  if (this.options.forceUnicode != null) {
2125
- return this.options.forceUnicode
2047
+ return this.options.forceUnicode;
2126
2048
  }
2127
2049
 
2128
- const LANG =
2129
- process.env.LANG +
2130
- ':' +
2131
- process.env.LANGUAGE +
2132
- ':' +
2133
- process.env.LC_ALL +
2134
- ':' +
2135
- process.env.LC_CTYPE
2050
+ var LANG = process.env.LANG
2051
+ + ':' + process.env.LANGUAGE
2052
+ + ':' + process.env.LC_ALL
2053
+ + ':' + process.env.LC_CTYPE;
2136
2054
 
2137
- return /utf-?8/i.test(LANG) || this.GetConsoleCP() === 65001
2138
- }
2055
+ return /utf-?8/i.test(LANG) || (this.GetConsoleCP() === 65001);
2056
+ };
2139
2057
 
2140
2058
  // For some reason TERM=linux has smacs/rmacs, but it maps to `^[[11m`
2141
2059
  // and it does not switch to the DEC SCLD character set. What the hell?
@@ -2148,119 +2066,112 @@ Tput.prototype.detectUnicode = function () {
2148
2066
  // ~/ncurses/ncurses/tinfo/lib_acs.c
2149
2067
  // ~/ncurses/ncurses/tinfo/tinfo_driver.c
2150
2068
  // ~/ncurses/ncurses/tinfo/lib_setup.c
2151
- Tput.prototype.detectBrokenACS = function (info) {
2069
+ Tput.prototype.detectBrokenACS = function(info) {
2152
2070
  // ncurses-compatible env variable.
2153
2071
  if (process.env.NCURSES_NO_UTF8_ACS != null) {
2154
- return !!+process.env.NCURSES_NO_UTF8_ACS
2072
+ return !!+process.env.NCURSES_NO_UTF8_ACS;
2155
2073
  }
2156
2074
 
2157
2075
  // If the terminal supports unicode, we don't need ACS.
2158
2076
  if (info.numbers.U8 >= 0) {
2159
- return !!info.numbers.U8
2077
+ return !!info.numbers.U8;
2160
2078
  }
2161
2079
 
2162
2080
  // The linux console is just broken for some reason.
2163
2081
  // Apparently the Linux console does not support ACS,
2164
2082
  // but it does support the PC ROM character set.
2165
2083
  if (info.name === 'linux') {
2166
- return true
2084
+ return true;
2167
2085
  }
2168
2086
 
2169
2087
  // PC alternate charset
2170
2088
  // if (acsc.indexOf('+\x10,\x11-\x18.\x190') === 0) {
2171
2089
  if (this.detectPCRomSet(info)) {
2172
- return true
2090
+ return true;
2173
2091
  }
2174
2092
 
2175
2093
  // screen termcap is bugged?
2176
- if (
2177
- this.termcap &&
2178
- info.name.indexOf('screen') === 0 &&
2179
- process.env.TERMCAP &&
2180
- ~process.env.TERMCAP.indexOf('screen') &&
2181
- ~process.env.TERMCAP.indexOf('hhII00')
2182
- ) {
2183
- if (
2184
- ~info.strings.enter_alt_charset_mode.indexOf('\x0E') ||
2185
- ~info.strings.enter_alt_charset_mode.indexOf('\x0F') ||
2186
- ~info.strings.set_attributes.indexOf('\x0E') ||
2187
- ~info.strings.set_attributes.indexOf('\x0F')
2188
- ) {
2189
- return true
2190
- }
2191
- }
2192
-
2193
- return false
2194
- }
2094
+ if (this.termcap
2095
+ && info.name.indexOf('screen') === 0
2096
+ && process.env.TERMCAP
2097
+ && ~process.env.TERMCAP.indexOf('screen')
2098
+ && ~process.env.TERMCAP.indexOf('hhII00')) {
2099
+ if (~info.strings.enter_alt_charset_mode.indexOf('\x0E')
2100
+ || ~info.strings.enter_alt_charset_mode.indexOf('\x0F')
2101
+ || ~info.strings.set_attributes.indexOf('\x0E')
2102
+ || ~info.strings.set_attributes.indexOf('\x0F')) {
2103
+ return true;
2104
+ }
2105
+ }
2106
+
2107
+ return false;
2108
+ };
2195
2109
 
2196
2110
  // If enter_pc_charset is the same as enter_alt_charset,
2197
2111
  // the terminal does not support SCLD as ACS.
2198
2112
  // See: ~/ncurses/ncurses/tinfo/lib_acs.c
2199
- Tput.prototype.detectPCRomSet = function (info) {
2200
- const s = info.strings
2201
- if (
2202
- s.enter_pc_charset_mode &&
2203
- s.enter_alt_charset_mode &&
2204
- s.enter_pc_charset_mode === s.enter_alt_charset_mode &&
2205
- s.exit_pc_charset_mode === s.exit_alt_charset_mode
2206
- ) {
2207
- return true
2208
- }
2209
- return false
2210
- }
2113
+ Tput.prototype.detectPCRomSet = function(info) {
2114
+ var s = info.strings;
2115
+ if (s.enter_pc_charset_mode && s.enter_alt_charset_mode
2116
+ && s.enter_pc_charset_mode === s.enter_alt_charset_mode
2117
+ && s.exit_pc_charset_mode === s.exit_alt_charset_mode) {
2118
+ return true;
2119
+ }
2120
+ return false;
2121
+ };
2211
2122
 
2212
- Tput.prototype.detectMagicCookie = function () {
2213
- return process.env.NCURSES_NO_MAGIC_COOKIE == null
2214
- }
2123
+ Tput.prototype.detectMagicCookie = function() {
2124
+ return process.env.NCURSES_NO_MAGIC_COOKIE == null;
2125
+ };
2215
2126
 
2216
- Tput.prototype.detectPadding = function () {
2217
- return process.env.NCURSES_NO_PADDING == null
2218
- }
2127
+ Tput.prototype.detectPadding = function() {
2128
+ return process.env.NCURSES_NO_PADDING == null;
2129
+ };
2219
2130
 
2220
- Tput.prototype.detectSetbuf = function () {
2221
- return process.env.NCURSES_NO_SETBUF == null
2222
- }
2131
+ Tput.prototype.detectSetbuf = function() {
2132
+ return process.env.NCURSES_NO_SETBUF == null;
2133
+ };
2223
2134
 
2224
- Tput.prototype.parseACS = function (info) {
2225
- const data = {}
2135
+ Tput.prototype.parseACS = function(info) {
2136
+ var data = {};
2226
2137
 
2227
- data.acsc = {}
2228
- data.acscr = {}
2138
+ data.acsc = {};
2139
+ data.acscr = {};
2229
2140
 
2230
2141
  // Possibly just return an empty object, as done here, instead of
2231
2142
  // specifically saying ACS is "broken" above. This would be more
2232
2143
  // accurate to ncurses logic. But it doesn't really matter.
2233
2144
  if (this.detectPCRomSet(info)) {
2234
- return data
2145
+ return data;
2235
2146
  }
2236
2147
 
2237
2148
  // See: ~/ncurses/ncurses/tinfo/lib_acs.c: L208
2238
- Object.keys(Tput.acsc).forEach(function (ch) {
2239
- const acs_chars = info.strings.acs_chars || '',
2240
- i = acs_chars.indexOf(ch),
2241
- next = acs_chars[i + 1]
2149
+ Object.keys(Tput.acsc).forEach(function(ch) {
2150
+ var acs_chars = info.strings.acs_chars || ''
2151
+ , i = acs_chars.indexOf(ch)
2152
+ , next = acs_chars[i + 1];
2242
2153
 
2243
2154
  if (!next || i === -1 || !Tput.acsc[next]) {
2244
- return
2155
+ return;
2245
2156
  }
2246
2157
 
2247
- data.acsc[ch] = Tput.acsc[next]
2248
- data.acscr[Tput.acsc[next]] = ch
2249
- })
2158
+ data.acsc[ch] = Tput.acsc[next];
2159
+ data.acscr[Tput.acsc[next]] = ch;
2160
+ });
2250
2161
 
2251
- return data
2252
- }
2162
+ return data;
2163
+ };
2253
2164
 
2254
- Tput.prototype.GetConsoleCP = function () {
2255
- let ccp
2165
+ Tput.prototype.GetConsoleCP = function() {
2166
+ var ccp;
2256
2167
 
2257
2168
  if (process.platform !== 'win32') {
2258
- return -1
2169
+ return -1;
2259
2170
  }
2260
2171
 
2261
2172
  // Allow unicode on all windows consoles for now:
2262
2173
  if (+process.env.NCURSES_UNICODE !== 0) {
2263
- return 65001
2174
+ return 65001;
2264
2175
  }
2265
2176
 
2266
2177
  // cp.execSync('chcp 65001', { stdio: 'ignore', timeout: 1500 });
@@ -2271,64 +2182,62 @@ Tput.prototype.GetConsoleCP = function () {
2271
2182
  stdio: ['ignore', 'pipe', 'ignore'],
2272
2183
  encoding: 'ascii',
2273
2184
  timeout: 1500
2274
- })
2185
+ });
2275
2186
  // ccp = cp.execSync('chcp', {
2276
2187
  // stdio: ['ignore', 'pipe', 'ignore'],
2277
2188
  // encoding: 'ascii',
2278
2189
  // timeout: 1500
2279
2190
  // });
2280
- } catch (e) {}
2191
+ } catch (e) {
2192
+ ;
2193
+ }
2281
2194
 
2282
- ccp = /\d+/.exec(ccp)
2195
+ ccp = /\d+/.exec(ccp);
2283
2196
 
2284
2197
  if (!ccp) {
2285
- return -1
2198
+ return -1;
2286
2199
  }
2287
2200
 
2288
- ccp = +ccp[0]
2201
+ ccp = +ccp[0];
2289
2202
 
2290
- return ccp
2291
- }
2203
+ return ccp;
2204
+ };
2292
2205
 
2293
2206
  /**
2294
2207
  * Helpers
2295
2208
  */
2296
2209
 
2297
2210
  function noop() {
2298
- return ''
2211
+ return '';
2299
2212
  }
2300
2213
 
2301
- noop.unsupported = true
2214
+ noop.unsupported = true;
2302
2215
 
2303
2216
  function merge(a, b) {
2304
- Object.keys(b).forEach(function (key) {
2305
- a[key] = b[key]
2306
- })
2307
- return a
2217
+ Object.keys(b).forEach(function(key) {
2218
+ a[key] = b[key];
2219
+ });
2220
+ return a;
2308
2221
  }
2309
2222
 
2310
2223
  function write(data) {
2311
- return process.stdout.write(data)
2224
+ return process.stdout.write(data);
2312
2225
  }
2313
2226
 
2314
2227
  function tryRead(file) {
2315
2228
  if (Array.isArray(file)) {
2316
- for (let i = 0; i < file.length; i++) {
2317
- const data = tryRead(file[i])
2318
- if (data) {
2319
- return data
2320
- }
2229
+ for (var i = 0; i < file.length; i++) {
2230
+ var data = tryRead(file[i]);
2231
+ if (data) return data;
2321
2232
  }
2322
- return ''
2323
- }
2324
- if (!file) {
2325
- return ''
2233
+ return '';
2326
2234
  }
2327
- file = path.resolve.apply(path, arguments)
2235
+ if (!file) return '';
2236
+ file = path.resolve.apply(path, arguments);
2328
2237
  try {
2329
- return fs.readFileSync(file, 'utf8')
2238
+ return fs.readFileSync(file, 'utf8');
2330
2239
  } catch (e) {
2331
- return ''
2240
+ return '';
2332
2241
  }
2333
2242
  }
2334
2243
 
@@ -2338,180 +2247,179 @@ function tryRead(file) {
2338
2247
  */
2339
2248
 
2340
2249
  function sprintf(src) {
2341
- let params = Array.prototype.slice.call(arguments, 1),
2342
- rule = /%([-+# ]{1,4})?(\d+(?:\.\d+)?)?([doxXsc])/g,
2343
- i = 0
2344
-
2345
- return src.replace(rule, function (_, flag, width, type) {
2346
- let flags = (flag || '').split(''),
2347
- param = params[i] != null ? params[i] : '',
2348
- initial = param,
2250
+ var params = Array.prototype.slice.call(arguments, 1)
2251
+ , rule = /%([\-+# ]{1,4})?(\d+(?:\.\d+)?)?([doxXsc])/g
2252
+ , i = 0;
2253
+
2254
+ return src.replace(rule, function(_, flag, width, type) {
2255
+ var flags = (flag || '').split('')
2256
+ , param = params[i] != null ? params[i] : ''
2257
+ , initial = param
2349
2258
  // , width = +width
2350
- opt = {},
2351
- pre = ''
2259
+ , opt = {}
2260
+ , pre = '';
2352
2261
 
2353
- i++
2262
+ i++;
2354
2263
 
2355
2264
  switch (type) {
2356
2265
  case 'd': // signed int
2357
- param = (+param).toString(10)
2358
- break
2266
+ param = (+param).toString(10);
2267
+ break;
2359
2268
  case 'o': // unsigned octal
2360
- param = (+param).toString(8)
2361
- break
2269
+ param = (+param).toString(8);
2270
+ break;
2362
2271
  case 'x': // unsigned hex int
2363
- param = (+param).toString(16)
2364
- break
2272
+ param = (+param).toString(16);
2273
+ break;
2365
2274
  case 'X': // unsigned hex int uppercase
2366
- param = (+param).toString(16).toUppercase()
2367
- break
2275
+ param = (+param).toString(16).toUppercase();
2276
+ break;
2368
2277
  case 's': // string
2369
- break
2278
+ break;
2370
2279
  case 'c': // char
2371
- param = isFinite(param) ? String.fromCharCode(param || 0x80) : ''
2372
- break
2280
+ param = isFinite(param)
2281
+ ? String.fromCharCode(param || 0x80)
2282
+ : '';
2283
+ break;
2373
2284
  }
2374
2285
 
2375
- flags.forEach(function (flag) {
2286
+ flags.forEach(function(flag) {
2376
2287
  switch (flag) {
2377
2288
  // left-justify by width
2378
2289
  case '-':
2379
- opt.left = true
2380
- break
2290
+ opt.left = true;
2291
+ break;
2381
2292
  // always precede numbers with their signs
2382
2293
  case '+':
2383
- opt.signs = true
2384
- break
2294
+ opt.signs = true;
2295
+ break;
2385
2296
  // used with o, x, X - value is preceded with 0, 0x, or 0X respectively.
2386
2297
  // used with a, A, e, E, f, F, g, G - forces written output to contain
2387
2298
  // a decimal point even if no more digits follow
2388
2299
  case '#':
2389
- opt.hexpoint = true
2390
- break
2300
+ opt.hexpoint = true;
2301
+ break;
2391
2302
  // if no sign is going to be written, black space in front of the value
2392
2303
  case ' ':
2393
- opt.space = true
2394
- break
2304
+ opt.space = true;
2305
+ break;
2395
2306
  }
2396
- })
2307
+ });
2397
2308
 
2398
- width = +width.split('.')[0]
2309
+ width = +width.split('.')[0];
2399
2310
 
2400
2311
  // Should this be for opt.left too?
2401
2312
  // Example: %2.2X - turns 0 into 00
2402
2313
  if (width && !opt.left) {
2403
- param = param + ''
2314
+ param = param + '';
2404
2315
  while (param.length < width) {
2405
- param = '0' + param
2316
+ param = '0' + param;
2406
2317
  }
2407
2318
  }
2408
2319
 
2409
2320
  if (opt.signs) {
2410
2321
  if (+initial >= 0) {
2411
- pre += '+'
2322
+ pre += '+';
2412
2323
  }
2413
2324
  }
2414
2325
 
2415
2326
  if (opt.space) {
2416
2327
  if (!opt.signs && +initial >= 0) {
2417
- pre += ' '
2328
+ pre += ' ';
2418
2329
  }
2419
2330
  }
2420
2331
 
2421
2332
  if (opt.hexpoint) {
2422
2333
  switch (type) {
2423
2334
  case 'o': // unsigned octal
2424
- pre += '0'
2425
- break
2335
+ pre += '0';
2336
+ break;
2426
2337
  case 'x': // unsigned hex int
2427
- pre += '0x'
2428
- break
2338
+ pre += '0x';
2339
+ break;
2429
2340
  case 'X': // unsigned hex int uppercase
2430
- pre += '0X'
2431
- break
2341
+ pre += '0X';
2342
+ break;
2432
2343
  }
2433
2344
  }
2434
2345
 
2435
2346
  if (opt.left) {
2436
- if (width > pre.length + param.length) {
2437
- width -= pre.length + param.length
2438
- pre = Array(width + 1).join(' ') + pre
2347
+ if (width > (pre.length + param.length)) {
2348
+ width -= pre.length + param.length;
2349
+ pre = Array(width + 1).join(' ') + pre;
2439
2350
  }
2440
2351
  }
2441
2352
 
2442
- return pre + param
2443
- })
2353
+ return pre + param;
2354
+ });
2444
2355
  }
2445
2356
 
2446
2357
  /**
2447
2358
  * Aliases
2448
2359
  */
2449
2360
 
2450
- Tput._alias = require('./alias')
2361
+ Tput._alias = require('./alias');
2451
2362
 
2452
- Tput.alias = {}
2363
+ Tput.alias = {};
2453
2364
 
2454
- ;['bools', 'numbers', 'strings'].forEach(function (type) {
2455
- Object.keys(Tput._alias[type]).forEach(function (key) {
2456
- const aliases = Tput._alias[type][key]
2457
- Tput.alias[key] = [aliases[0]]
2458
- Tput.alias[key].terminfo = aliases[0]
2459
- Tput.alias[key].termcap = aliases[1]
2460
- })
2461
- })
2365
+ ['bools', 'numbers', 'strings'].forEach(function(type) {
2366
+ Object.keys(Tput._alias[type]).forEach(function(key) {
2367
+ var aliases = Tput._alias[type][key];
2368
+ Tput.alias[key] = [aliases[0]];
2369
+ Tput.alias[key].terminfo = aliases[0];
2370
+ Tput.alias[key].termcap = aliases[1];
2371
+ });
2372
+ });
2462
2373
 
2463
2374
  // Bools
2464
- Tput.alias.no_esc_ctlc.push('beehive_glitch')
2465
- Tput.alias.dest_tabs_magic_smso.push('teleray_glitch')
2375
+ Tput.alias.no_esc_ctlc.push('beehive_glitch');
2376
+ Tput.alias.dest_tabs_magic_smso.push('teleray_glitch');
2466
2377
 
2467
2378
  // Numbers
2468
- Tput.alias.micro_col_size.push('micro_char_size')
2379
+ Tput.alias.micro_col_size.push('micro_char_size');
2469
2380
 
2470
2381
  /**
2471
2382
  * Feature Checking
2472
2383
  */
2473
2384
 
2474
- Tput.aliasMap = {}
2385
+ Tput.aliasMap = {};
2475
2386
 
2476
- Object.keys(Tput.alias).forEach(function (key) {
2477
- Tput.aliasMap[key] = key
2478
- Tput.alias[key].forEach(function (k) {
2479
- Tput.aliasMap[k] = key
2480
- })
2481
- })
2387
+ Object.keys(Tput.alias).forEach(function(key) {
2388
+ Tput.aliasMap[key] = key;
2389
+ Tput.alias[key].forEach(function(k) {
2390
+ Tput.aliasMap[k] = key;
2391
+ });
2392
+ });
2482
2393
 
2483
- Tput.prototype.has = function (name) {
2484
- name = Tput.aliasMap[name]
2394
+ Tput.prototype.has = function(name) {
2395
+ name = Tput.aliasMap[name];
2485
2396
 
2486
- const val = this.all[name]
2397
+ var val = this.all[name];
2487
2398
 
2488
- if (!name) {
2489
- return false
2490
- }
2399
+ if (!name) return false;
2491
2400
 
2492
2401
  if (typeof val === 'number') {
2493
- return val !== -1
2402
+ return val !== -1;
2494
2403
  }
2495
2404
 
2496
- return !!val
2497
- }
2405
+ return !!val;
2406
+ };
2498
2407
 
2499
2408
  /**
2500
2409
  * Fallback Termcap Entry
2501
2410
  */
2502
2411
 
2503
- Tput.termcap =
2504
- '' +
2505
- 'vt102|dec vt102:' +
2506
- ':do=^J:co#80:li#24:cl=50\\E[;H\\E[2J:' +
2507
- ':le=^H:bs:cm=5\\E[%i%d;%dH:nd=2\\E[C:up=2\\E[A:' +
2508
- ':ce=3\\E[K:cd=50\\E[J:so=2\\E[7m:se=2\\E[m:us=2\\E[4m:ue=2\\E[m:' +
2509
- ':md=2\\E[1m:mr=2\\E[7m:mb=2\\E[5m:me=2\\E[m:is=\\E[1;24r\\E[24;1H:' +
2510
- ':rs=\\E>\\E[?3l\\E[?4l\\E[?5l\\E[?7h\\E[?8h:ks=\\E[?1h\\E=:ke=\\E[?1l\\E>:' +
2511
- ':ku=\\EOA:kd=\\EOB:kr=\\EOC:kl=\\EOD:kb=^H:\\\n' +
2512
- ':ho=\\E[H:k1=\\EOP:k2=\\EOQ:k3=\\EOR:k4=\\EOS:pt:sr=5\\EM:vt#3:' +
2513
- ':sc=\\E7:rc=\\E8:cs=\\E[%i%d;%dr:vs=\\E[?7l:ve=\\E[?7h:' +
2514
- ':mi:al=\\E[L:dc=\\E[P:dl=\\E[M:ei=\\E[4l:im=\\E[4h:'
2412
+ Tput.termcap = ''
2413
+ + 'vt102|dec vt102:'
2414
+ + ':do=^J:co#80:li#24:cl=50\\E[;H\\E[2J:'
2415
+ + ':le=^H:bs:cm=5\\E[%i%d;%dH:nd=2\\E[C:up=2\\E[A:'
2416
+ + ':ce=3\\E[K:cd=50\\E[J:so=2\\E[7m:se=2\\E[m:us=2\\E[4m:ue=2\\E[m:'
2417
+ + ':md=2\\E[1m:mr=2\\E[7m:mb=2\\E[5m:me=2\\E[m:is=\\E[1;24r\\E[24;1H:'
2418
+ + ':rs=\\E>\\E[?3l\\E[?4l\\E[?5l\\E[?7h\\E[?8h:ks=\\E[?1h\\E=:ke=\\E[?1l\\E>:'
2419
+ + ':ku=\\EOA:kd=\\EOB:kr=\\EOC:kl=\\EOD:kb=^H:\\\n'
2420
+ + ':ho=\\E[H:k1=\\EOP:k2=\\EOQ:k3=\\EOR:k4=\\EOS:pt:sr=5\\EM:vt#3:'
2421
+ + ':sc=\\E7:rc=\\E8:cs=\\E[%i%d;%dr:vs=\\E[?7l:ve=\\E[?7h:'
2422
+ + ':mi:al=\\E[L:dc=\\E[P:dl=\\E[M:ei=\\E[4l:im=\\E[4h:';
2515
2423
 
2516
2424
  /**
2517
2425
  * Terminfo Data
@@ -2564,7 +2472,7 @@ Tput.bools = [
2564
2472
  'linefeed_is_newline',
2565
2473
  'has_hardware_tabs',
2566
2474
  'return_does_clr_eol'
2567
- ]
2475
+ ];
2568
2476
 
2569
2477
  Tput.numbers = [
2570
2478
  'columns',
@@ -2608,7 +2516,7 @@ Tput.numbers = [
2608
2516
  'backspace_delay',
2609
2517
  'horizontal_tab_delay',
2610
2518
  'number_of_function_keys'
2611
- ]
2519
+ ];
2612
2520
 
2613
2521
  Tput.strings = [
2614
2522
  'back_tab',
@@ -3027,44 +2935,43 @@ Tput.strings = [
3027
2935
  'memory_lock',
3028
2936
  'memory_unlock',
3029
2937
  'box_chars_1'
3030
- ]
2938
+ ];
3031
2939
 
3032
2940
  // DEC Special Character and Line Drawing Set.
3033
2941
  // Taken from tty.js.
3034
- Tput.acsc = {
3035
- // (0
2942
+ Tput.acsc = { // (0
3036
2943
  '`': '\u25c6', // '◆'
3037
- a: '\u2592', // '▒'
3038
- b: '\u0009', // '\t'
3039
- c: '\u000c', // '\f'
3040
- d: '\u000d', // '\r'
3041
- e: '\u000a', // '\n'
3042
- f: '\u00b0', // '°'
3043
- g: '\u00b1', // '±'
3044
- h: '\u2424', // '\u2424' (NL)
3045
- i: '\u000b', // '\v'
3046
- j: '\u2518', // '┘'
3047
- k: '\u2510', // '┐'
3048
- l: '\u250c', // '┌'
3049
- m: '\u2514', // '└'
3050
- n: '\u253c', // '┼'
3051
- o: '\u23ba', // '⎺'
3052
- p: '\u23bb', // '⎻'
3053
- q: '\u2500', // '─'
3054
- r: '\u23bc', // '⎼'
3055
- s: '\u23bd', // '⎽'
3056
- t: '\u251c', // '├'
3057
- u: '\u2524', // '┤'
3058
- v: '\u2534', // '┴'
3059
- w: '\u252c', // '┬'
3060
- x: '\u2502', // '│'
3061
- y: '\u2264', // '≤'
3062
- z: '\u2265', // '≥'
2944
+ 'a': '\u2592', // '▒'
2945
+ 'b': '\u0009', // '\t'
2946
+ 'c': '\u000c', // '\f'
2947
+ 'd': '\u000d', // '\r'
2948
+ 'e': '\u000a', // '\n'
2949
+ 'f': '\u00b0', // '°'
2950
+ 'g': '\u00b1', // '±'
2951
+ 'h': '\u2424', // '\u2424' (NL)
2952
+ 'i': '\u000b', // '\v'
2953
+ 'j': '\u2518', // '┘'
2954
+ 'k': '\u2510', // '┐'
2955
+ 'l': '\u250c', // '┌'
2956
+ 'm': '\u2514', // '└'
2957
+ 'n': '\u253c', // '┼'
2958
+ 'o': '\u23ba', // '⎺'
2959
+ 'p': '\u23bb', // '⎻'
2960
+ 'q': '\u2500', // '─'
2961
+ 'r': '\u23bc', // '⎼'
2962
+ 's': '\u23bd', // '⎽'
2963
+ 't': '\u251c', // '├'
2964
+ 'u': '\u2524', // '┤'
2965
+ 'v': '\u2534', // '┴'
2966
+ 'w': '\u252c', // '┬'
2967
+ 'x': '\u2502', // '│'
2968
+ 'y': '\u2264', // '≤'
2969
+ 'z': '\u2265', // '≥'
3063
2970
  '{': '\u03c0', // 'π'
3064
2971
  '|': '\u2260', // '≠'
3065
2972
  '}': '\u00a3', // '£'
3066
- '~': '\u00b7' // '·'
3067
- }
2973
+ '~': '\u00b7' // '·'
2974
+ };
3068
2975
 
3069
2976
  // Convert ACS unicode characters to the
3070
2977
  // most similar-looking ascii characters.
@@ -3099,15 +3006,15 @@ Tput.utoa = Tput.prototype.utoa = {
3099
3006
  '\u03c0': '?', // 'π'
3100
3007
  '\u2260': '=', // '≠'
3101
3008
  '\u00a3': '?', // '£'
3102
- '\u00b7': '*' // '·'
3103
- }
3009
+ '\u00b7': '*' // '·'
3010
+ };
3104
3011
 
3105
3012
  /**
3106
3013
  * Expose
3107
3014
  */
3108
3015
 
3109
- exports = Tput
3110
- exports.sprintf = sprintf
3111
- exports.tryRead = tryRead
3016
+ exports = Tput;
3017
+ exports.sprintf = sprintf;
3018
+ exports.tryRead = tryRead;
3112
3019
 
3113
- module.exports = exports
3020
+ module.exports = exports;