샘플
sprintf-js 1.1.3: vsprintf
검증된 샘플 — npm sprintf-js 1.1.3: vsprintf. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: vsprintf formats strings by interpolating an array of…
sha256:f5a4143a9b2da1b21d060a0fa2ba47e48b95b3926bb61d0f9e59890f9c0268dd
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 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-26 |
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-07 |
케이스
HOW- 목표
- verify vsprintf in pkg:npm/sprintf-js@1.1.3
- 패키지
- 심벌
-
- vsprintf
- 생성일
- 2026-08-26T11:20:30Z
컨트랙트
- vsprintf formats strings by interpolating an array of positional values into placeholder specifiers
- vsprintf formats numbers with specified width, zero padding, sign, and decimal precision
- vsprintf supports alternative base conversions including hexadecimal, binary, and octal
- vsprintf supports explicit argument indexing to rearrange argument order
- vsprintf formats named object properties passed within an array argument
- vsprintf serializes complex JavaScript objects to JSON with the %j specifier
- vsprintf pads strings with custom fill characters and left or right alignment
- vsprintf throws an error when format strings contain syntax errors or missing required arguments
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
소스
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 vsprintf in pkg:npm/sprintf-js@1.1.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/sprintf-js@1.1.3
Demonstrate these symbols/APIs:
- vsprintf
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:7d51b3521f26595ed76fdc7827701a12ba4df0adaf293bb78404644e85c0c4be","contract":["vsprintf formats strings by interpolating an array of positional values into placeholder specifiers","vsprintf formats numbers with specified width, zero padding, sign, and decimal precision","vsprintf supports alternative base conversions including hexadecimal, binary, and octal","vsprintf supports explicit argument indexing to rearrange argument order","vsprintf formats named object properties passed within an array argument","vsprintf serializes complex JavaScript objects to JSON with the %j specifier","vsprintf pads strings with custom fill characters and left or right alignment","vsprintf throws an error when format strings contain syntax errors or missing required arguments"],"goal":"verify vsprintf in pkg:npm/sprintf-js@1.1.3","kind":"HOW","packages":["pkg:npm/sprintf-js@1.1.3"],"schemaVersion":1,"symbols":["vsprintf"]},"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/sprintf-js@1.1.3"],"schemaVersion":1,"subject":"pkg:npm/sprintf-js@1.1.3","symbols":["vsprintf"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-3754283252",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-3754283252",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"sprintf-js": "^1.1.3"
}
},
"node_modules/sprintf-js": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
"integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",
"license": "BSD-3-Clause"
}
}
}
{
"name": "sample-sprintf-js",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"sprintf-js": "1.1.3"
}
}
{
"schemaVersion": 1,
"goal": "verify vsprintf in pkg:npm/sprintf-js@1.1.3",
"kind": "HOW",
"packages": [
"pkg:npm/sprintf-js@1.1.3"
],
"symbols": [
"vsprintf"
]
}
import sprintfJs from 'sprintf-js';
const { vsprintf, sprintf } = sprintfJs;
/**
* Format a string with an array of arguments using vsprintf.
* @param {string} format Format specification string
* @param {Array<any>} args Array of arguments
* @returns {string} Formatted string
*/
export function formatWithArray(format, args) {
return vsprintf(format, args);
}
/**
* Format a string with named arguments using vsprintf.
* @param {string} format Format specification string with named keys
* @param {Record<string, any>} data Named parameters object
* @returns {string} Formatted string
*/
export function formatWithNamed(format, data) {
return vsprintf(format, [data]);
}
export { vsprintf, sprintf };
export default vsprintf;
import assert from 'node:assert/strict';
import { vsprintf, sprintf, formatWithArray, formatWithNamed } from '../src/index.mjs';
// 1. vsprintf formats strings by interpolating an array of positional values into placeholder specifiers
{
const result = vsprintf('%s is %d years old', ['Alice', 30]);
assert.equal(result, 'Alice is 30 years old');
const helperResult = formatWithArray('Hello, %s!', ['world']);
assert.equal(helperResult, 'Hello, world!');
}
// 2. vsprintf formats numbers with specified width, zero padding, sign, and decimal precision
{
const pi = vsprintf('%.2f', [3.14159265]);
assert.equal(pi, '3.14');
const paddedInt = vsprintf('%05d', [42]);
assert.equal(paddedInt, '00042');
const signs = vsprintf('%+d and %+d', [10, -10]);
assert.equal(signs, '+10 and -10');
}
// 3. vsprintf supports alternative base conversions including hexadecimal, binary, and octal
{
const hex = vsprintf('%x / %X', [255, 255]);
assert.equal(hex, 'ff / FF');
const bin = vsprintf('%b', [13]);
assert.equal(bin, '1101');
const oct = vsprintf('%o', [64]);
assert.equal(oct, '100');
}
// 4. vsprintf supports explicit argument indexing to rearrange argument order
{
const reordered = vsprintf('%2$s before %1$s', ['first', 'second']);
assert.equal(reordered, 'second before first');
}
// 5. vsprintf formats named object properties passed within an array argument
{
const userGreeting = vsprintf('User %(name)s logged in %(count)d times', [{ name: 'Bob', count: 5 }]);
assert.equal(userGreeting, 'User Bob logged in 5 times');
const helperNamed = formatWithNamed('Item: %(item)s, Price: $%(price).2f', { item: 'Widget', price: 9.99 });
assert.equal(helperNamed, 'Item: Widget, Price: $9.99');
}
// 6. vsprintf serializes complex JavaScript objects to JSON with the %j specifier
{
const jsonStr = vsprintf('Data: %j', [{ id: 101, active: true }]);
assert.equal(jsonStr, 'Data: {"id":101,"active":true}');
}
// 7. vsprintf pads strings with custom fill characters and left or right alignment
{
const rightPadded = vsprintf("%'#-8s", ['pad']);
assert.equal(rightPadded, 'pad#####');
const leftPadded = vsprintf("%'#8s", ['pad']);
assert.equal(leftPadded, '#####pad');
}
// 8. vsprintf throws an error when format strings contain syntax errors or missing required arguments
{
assert.throws(() => vsprintf('%d', []), /\[sprintf\]/);
assert.throws(() => vsprintf('%', ['test']), /\[sprintf\]/);
}
console.log('Contract assertions passed.');
오리진 시더
익명