Moved extend & promote into their own files, and fixed case on indexOf.js

Signed-off-by: Grant Skinner <info@gskinner.com>