Skip to content
Local javascript module system
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples/shouter
README.md
wood.js

README.md

Wood

Wood is a module system for Javascript. It loads modules locally or on a web server without any setup.


Basic Use


engrave
Engrave an ancient truth into wood.

let greet = (name) => print(`Hello ${name}!`)
engrave(greet)


discover
Discover an ancient engraving (unless it has already been discovered).

discover("greet.js")


learn
Learn an ancient truth from an engraving.

discover("greet.js")
x=o=> {
	let greet = learn("greet", "greet.js")
	greet("Luke")
}

Other Stuff


x=o=>
Runs a block of code after all ancient engravings have been discovered.

discover("greet.js")
x=o=> {
	print("Ancient engravings have been discovered!")
}


test
Defines a test for an engraved item.

let add = (a, b) => a + b
engrave(add)
test(add, o=> add(1, 2) == 3)

Settings


Wood.path
Where are the ancient engravings?
(default: "")


Wood.runTests
Should we run tests?
(default: true)


Wood.needEngraveTests
Do engraved items need tests?
(default: true)


Wood.needLearnTests
Do learned items need tests?
(default: false)


Shortcuts


print
assert
dir
warn
error

You can’t perform that action at this time.