Skip to content

Instantly share code, notes, and snippets.

class A
{
"author": "robert kuzelj <robert@capitalize.org>",
"name": "capitalize",
"description": "capitalizes and decapitalizes a string",
"version": "0.1.0",
"homepage": "www.capitalize.org",
"repository": {
"url": ""
},
"main": "main.js",
function capitalize(value)
{
return value.toUpperCase();
}
exports.capitalize = capitalize
function decapitalize(value)
{
return value.toLowerCase();
}
exports.decapitalize = decapitalize
exports.capitalize = require('./lib/capitalize').capitalize;
exports.decapitalize = require('./lib/decapitalize').decapitalize;
var capitalize = require("capitalize").capitalize;
var decapitalize = require("capitalize").decapitalize;
console.log(capitalize("foo"));
console.log(decapitalize("BAR"));
@robkuz
robkuz / package.json
Created December 14, 2011 13:15
our new package.json for our command line tool
{
"author": "robert kuzelj <robert@capitalize.org>",
"name": "capitalize",
"description": "capitalizes and decapitalizes a string",
"version": "0.2.0",
"homepage": "www.capitalize.org",
"repository":
{
"url": ""
},
@robkuz
robkuz / cap.js
Created December 14, 2011 13:39
command line tool
#!/usr/bin/env node
var capitalize = require("../main.js");
var action = process.argv[2];
var value = process.argv[3];
if (action == "-c")
{
console.log(capitalize.capitalize(value));
}
#!/usr/bin/env node
var capitalize = require("../main.js");
var value = process.argv[2];
console.log(capitalize.capitalize(value));
#!/usr/bin/env node
var capitalize = require("../main.js");
var value = process.argv[2];
console.log(capitalize.decapitalize(value));