샘플
dedent 1.7.2: verify multiline string indentation removal and options
검증된 샘플 — npm dedent 1.7.2: verify multiline string indentation removal and options. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다.
sha256:1b6bd529c87a9494dce6c2078968d99f1b21ef5c5e4f9f23329fad5e7d224b41
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
케이스
HOW- 목표
- verify pkg:npm/dedent@1.7.2 multiline string indentation removal and options
- 패키지
- 심벌
-
- dedent
- 생성일
- 2026-08-27T16:34:43Z
컨트랙트
- Calling dedent as a tagged template literal strips common indentation and leading/trailing blank lines.
- Calling dedent as a function strips common indentation from string input.
- dedent.withOptions({ alignValues: true }) aligns subsequent lines of multiline interpolated values to the interpolation column.
- dedent.withOptions({ trimWhitespace: false }) preserves leading and trailing whitespace around the dedented text.
- dedent.withOptions({ escapeSpecialCharacters: false }) preserves backslashes before special characters in template strings.
파일
- NOTES.md
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
# Dedent multiline string indentation removal and options in Node.js
`pkg:npm/dedent@1.7.2` provides template tag and function call utilities to strip common leading indentation and leading/trailing blank lines from multiline strings.
## Key Features & Invocations
1. **Tagged Template Literal**: Calling `dedent` as a template tag strips common indentation from multiline text while preserving relative indentation.
2. **Function Call**: Calling `dedent(...)` directly with a string input strips leading indentation identically.
3. **Custom Options (`dedent.withOptions`)**:
- `alignValues`: When `true`, multiline string interpolations (`${...}`) maintain indentation relative to the interpolation column.
- `trimWhitespace`: When `false`, leading and trailing whitespace and blank lines are preserved.
- `escapeSpecialCharacters`: When `false`, backslashes before special characters such as `$` in raw template strings are retained.
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:npm/dedent@1.7.2 multiline string indentation removal and options
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/dedent@1.7.2
Demonstrate these symbols/APIs:
- dedent
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:d454e588cd038ef3b8b96da427f8121c029e715378105fcd0ddf153ff90e8d8f","contract":["Calling dedent as a tagged template literal strips common indentation and leading/trailing blank lines.","Calling dedent as a function strips common indentation from string input.","dedent.withOptions({ alignValues: true }) aligns subsequent lines of multiline interpolated values to the interpolation column.","dedent.withOptions({ trimWhitespace: false }) preserves leading and trailing whitespace around the dedented text.","dedent.withOptions({ escapeSpecialCharacters: false }) preserves backslashes before special characters in template strings."],"goal":"verify pkg:npm/dedent@1.7.2 multiline string indentation removal and options","kind":"HOW","packages":["pkg:npm/dedent@1.7.2"],"schemaVersion":1,"symbols":["dedent"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/dedent@1.7.2"],"schemaVersion":1,"subject":"pkg:npm/dedent@1.7.2","symbols":["dedent"],"verifierAdapter":"node-typescript@1"}
import dedent from "dedent";
// Example 1: Tagged template literal
const multiline = dedent`
function example() {
return true;
}
`;
// Example 2: Function call
const functionCall = dedent(`
first line
nested line
`);
// Example 3: Customized options
const customDedent = dedent.withOptions({
alignValues: true,
trimWhitespace: true,
});
const items = dedent`
- first
- second
`;
const formatted = customDedent`
List:
${items}
`;
console.log("Dedent multiline string output:\n" + multiline);
console.log("\nFunction call output:\n" + functionCall);
console.log("\nCustom options output:\n" + formatted);
{
"name": "sample-dedent",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-dedent",
"version": "1.0.0",
"dependencies": {
"dedent": "1.7.2"
}
},
"node_modules/dedent": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/dedent/-/dedent-1.7.2.tgz",
"integrity": "sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA==",
"license": "MIT",
"peerDependencies": {
"babel-plugin-macros": "^3.1.0"
},
"peerDependenciesMeta": {
"babel-plugin-macros": {
"optional": true
}
}
}
}
}
{
"name": "sample-dedent",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"dedent": "1.7.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/dedent@1.7.2 multiline string indentation removal and options",
"kind": "HOW",
"packages": [
"pkg:npm/dedent@1.7.2"
],
"symbols": [
"dedent"
]
}
import assert from "node:assert/strict";
import dedent from "dedent";
// 1. Tagged template literal usage strips common indentation and leading/trailing blank lines
const tagged = dedent`
line 1
line 2
line 3
`;
assert.equal(tagged, "line 1\n line 2\nline 3");
// 2. Function call usage strips indentation from string input
const called = dedent(`
function call
indented
`);
assert.equal(called, "function call\n indented");
// 3. Option: alignValues aligns multiline interpolated strings to the column where they are injected
const multilineItem = dedent`
item A
item B
`;
const aligned = dedent.withOptions({ alignValues: true })`
Header:
${multilineItem}
Footer
`;
assert.equal(aligned, "Header:\n item A\n item B\nFooter");
// 4. Option: trimWhitespace: false preserves leading and trailing whitespace
const untrimmed = dedent.withOptions({ trimWhitespace: false })`
first
second
`;
assert.equal(untrimmed, "\nfirst\nsecond\n");
// 5. Option: escapeSpecialCharacters: false keeps backslash before special characters
const escapedDefault = dedent`
\$hello
`;
assert.equal(escapedDefault, "$hello");
const unescaped = dedent.withOptions({ escapeSpecialCharacters: false })`
\$hello
`;
assert.equal(unescaped, "\\$hello");
console.log("Contract verified.");
오리진 시더
익명