codedent

A dedent alternative for just code

ISC 5 个版本
安装
npm install codedent
yarn add codedent
pnpm add codedent
bun add codedent
README

codedent

build status Coverage Status

Usable both as template literal tag or just as callback for strings, removes all spaces found at the very first line of code encountered while sanitizing, keeping everything else around.

import dedent from 'codedent';

dedent`
  def this_is_fine():
    return "fine"
`;

/**
def this_is_fine():
  return "fine"
*/

Differently from dedent module, this one doesn't care about code starting in one line then indented in others ... it's just code as you pass it along, no magic involved.

版本列表
0.1.3 2026-06-22
0.1.2 2023-09-06
0.1.1 2023-09-05
0.1.0 2023-09-05
0.0.0 2023-09-05