Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Changelog
0.0.2 / 2011-09-04 ##
Readme
Runtime documentation tool for REPL.
Have you ever wished you could see docs for the given function right out of the REPL? If so, this tool is for you!
var doc = require('doc').doc
doc(doc) // Prints following output:
/*
function doc(source) { ... }
-----------------------------------------------
Prints documentanion of the given function
*/
// You can also document your own functions:
function compose() {
doc: "Returns the composition of a list of functions, where each function"
| "consumes the return value of the function that follows. In math"
| "terms, composing the functions `f()`, `g()`, and `h()` produces"
| "`f(g(h()))`."
| "Usage:"
| "var greet = function(name) { return 'hi: ' + name }"
| "var exclaim = function(statement) { return statement + '!' }"
| "var welcome = compose(exclaim, greet)"
| "welcome('moe')"
| "//> 'hi: moe!'"
var funcs = Array.prototype.slice.call(arguments)
return function composed() {
var args = slice.call(arguments)
var i = funcs.length
while (0 <= --i) args = [ funcs[i].apply(this, args) ]
return args[0]
}
}
doc(compose) // Prints following output:
/*
function compose() { ... }
-----------------------------------------------
Returns the composition of a list of functions, where each function
consumes the return value of the function that follows. In math
terms, composing the functions `f()`, `g()`, and `h()` produces
`f(g(h()))`.
Usage:
var greet = function(name) { return 'hi: ' + name }
var exclaim = function(statement) { return statement + '!' }
var welcome = compose(exclaim, greet)
welcome('moe')
//> 'hi: moe!'
*/
// Alternative way to documenting functions (Not cross platform though):
function sum(a, b) {
/**
Takes arbitary number of arguments and returns their sum.
Usage:
sum(7, 2, 8) //> 17
**/
var count = arguments.length, index = 0, value = 0
while (index < count) value += arguments[index++]
return value
}
doc(sum) // Prints following output:
/*
function sum(a, b) { ... }
-----------------------------------------------
Takes arbitary number of arguments and returns their sum.
Usage:
sum(7, 2, 8) //> 17
*/
npm install doc
FAQs
Runtime documentation tool for REPL
The npm package doc receives a total of 2,444 weekly downloads. As such, doc popularity was classified as popular.
We found that doc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.