Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pllee committed Aug 3, 2013
1 parent 6dc359c commit 199f72e
Show file tree
Hide file tree
Showing 12 changed files with 5,419 additions and 15 deletions.
15 changes: 1 addition & 14 deletions .gitignore
@@ -1,14 +1 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

npm-debug.log
node_modules/
4 changes: 4 additions & 0 deletions .travis.yml
@@ -0,0 +1,4 @@
language: node_js
node_js:
- "0.8"
- "0.10"
35 changes: 35 additions & 0 deletions Gruntfile.js
@@ -0,0 +1,35 @@

module.exports = function(grunt) {
grunt.initConfig({
exec: {
buildSrc: {
cmd: 'node_modules/.bin/browserify --debug lib/counsell.js > build/counsell.js'
},
buildTest: {
cmd: 'node_modules/.bin/browserify --debug test/counsell.js > pages/testRunner/build/tests.js'
},
runTest: {
cmd: 'node_modules/.bin/mocha -R list'
}
},
uglify: {
compress: {
files: {
'build/counsell.min.js': ['build/counsell.js']
},
options: {
mangle: false,
preserveComments: 'some',
banner: '/**\n' +
' * @license https://github.com/pllee/counsell/blob/master/LICENSE\n' +
' */\n'
}
}
}
});

grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['exec', 'uglify']);

};
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
counsell
========

23 console aliases that work where supported and run on all browsers. console.time for IE.
21 console aliases that work where supported and run on all browsers. console.time for IE.
48 changes: 48 additions & 0 deletions build/counsell.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions build/counsell.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/counsell-web.js
@@ -0,0 +1,3 @@
var counsell = require('./counsell');

window.counsell = counsell;
44 changes: 44 additions & 0 deletions lib/counsell.js
@@ -0,0 +1,44 @@
var methods = ["debug", "error", "info", "log", "warn", "dir", "dirxml", "table", "trace", "assert", "count", "markTimeline", "profile", "profileEnd", "time", "timeEnd", "timeStamp", "group", "groupCollapsed", "groupEnd", "clear"],
con = module.exports = {},
i,
len = methods.length,
emptyFn = function() {},
createConsoleFn,
timeIds;



if (typeof console === 'undefined') {
for (i = 0; i < len; ++i) {
con[methods[i]] = emptyFn;
}
} else {
createConsoleFn = function(methodName) {
if (console[methodName]) {
return function() {
return console[methodName].apply(console, arguments);
};
}

return emptyFn;
};

for (i = 0; i < len; ++i) {
con[methods[i]] = createConsoleFn(methods[i]);
}

//IE
if(con.time === emptyFn) {
timeIds = {};

con.time = function(id) {
timeIds[id] = new Date().getTime();
};

con.timeEnd = function(id) {
var millis = new Date().getTime() - timeIds[id];
delete timeIds.id;
console.log('%s: %sms', id, millis);
};
}
}
50 changes: 50 additions & 0 deletions package.json
@@ -0,0 +1,50 @@
{
"name": "counsell",
"version": "0.1.0",
"description": "all console methods that run on all browsers and node",
"main": "lib/counsell.js",
"repository": {
"type": "git",
"url": "https://github.com/pllee/counsell.git"
},
"keywords": [
"console",
"console.time"
],
"devDependencies": {
"expect.js": "0.2.0",
"mocha": "~1.11.0",
"grunt-exec": "~0.4.2",
"grunt-contrib-uglify": "~0.2.2",
"browserify": "2.23.1",
"grunt-cli": "~0.1.9"
},
"testling": {
"browsers": [
"ie6",
"ie7",
"ie8",
"ie9",
"firefox/3.0",
"firefox/4.0",
"firefox/19",
"firefox/nightly",
"chrome/24",
"chrome/25",
"chrome/canary",
"opera/12",
"opera/next",
"safari/5.1",
"safari/6.0",
"iphone/6.0",
"ipad/6.0"
],
"harness": "mocha",
"files": "test/*.js"
},
"scripts": {
"test": "node_modules/.bin/mocha"
},
"author": "Patrick Lee",
"license": "MIT"
}

0 comments on commit 199f72e

Please sign in to comment.