Registry / devops / utc
library0.1.0jsnpmunverified

utc is a CLI tool that compiles Underscore.js-style templates into AMD-compatible JavaScript functions. Version 0.1.0 (released 2012) is the only release. It precompiles templates to avoid runtime parsing, suitable for build-time optimization. No active maintenance or updates exist. The tool converts template strings containing <%= ... %> into compiled functions that use with() and concatenated output.

npm install utc
INSTALL
IMPORT
SIG · UTC
U
utc
devopsjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

utc CLI
Run globally: utc -d "templates" -s "Template" -f "Str"
Trying to require('utc') in Node.js code
utc is a CLI tool, not a library. No Node.js API is exported.

Shows installation, creating a template file, and compiling it with utc CLI to convert Underscore templates into precompiled functions.

# Install globally npm install -g utc@0.1.0 # Create a template file echo '(function () { define(function () { return { getListTemplateStr: function () { return this._helper() + ": <%= name %>"; }, _helper: function () { return "hello"; } }; }); }).call(this);' > templates/sampleTemplate.js # Run the compiler utc -d "templates" -s "Template" -f "Str"
utc --version
Debug
Known issues
deprecatedPackage has not been updated since 2012; no support for modern ECMAScript features or module systems beyond AMD.
fix
Use modern alternatives like Lodash _.template, handlebars precompilation, or EJS.
affects: 0.1.0
gotchaCLI modifies files in-place! Use version control or backups before running.
fix
Copy templates to a build directory first, or use a different build tool that outputs to a separate folder.
affects: 0.1.0
gotchaOnly works with AMD-style modules (define). No CommonJS, ES module, or global export support.
fix
Write templates in AMD format or use a wrapper script to convert output.
affects: 0.1.0
breakingUses with(obj) statement in compiled code, which is forbidden in strict mode and may cause performance issues or errors in modern JS environments.
fix
Use a template engine that avoids with(), like Lodash (with option) or Handlebars.
affects: 0.1.0
gotchaCLI arguments must exactly match: -d (directory), -s (suffix), -f (function suffix). No configuration file support.
fix
Wrap in a shell script or npm script to avoid repeated typing.
affects: 0.1.0
Errors
Common errors & fixes
require('utc') is not a function
utc is a CLI tool only; no module exports.
fix
Use the global command utc, e.g., from terminal: utc -d ./templates -s Template -f Str
ENOENT: no such file or directory, open '...'?
The -d directory path does not exist or contains no files matching the suffix.
fix
Ensure directory exists and file suffix matches: e.g., -s Template looks for *Template.js files.
TypeError: Cannot read property '1' of null
Template file does not follow the expected AMD pattern shown in the readme.
fix
Template must be a function that returns an object with methods containing Underscore template strings.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
utc — npm install utc · libregistry