-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
998aab8
commit faeb2ea
Showing
15 changed files
with
206 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.git* | ||
src/ | ||
spec/ | ||
.travis.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
language: node_js | ||
node_js: | ||
- "0.10" | ||
before_install: | ||
- npm install -g grunt-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
module.exports = function(grunt) { | ||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
meta: { | ||
version: '<%= pkg.version %>', | ||
banner: | ||
'// <%= pkg.name %>\n' + | ||
'// -------------------\n' + | ||
'// v<%= pkg.version %>\n' + | ||
'//\n' + | ||
'// Copyright (c) 2013-<%= grunt.template.today("yyyy") %> Mateus Maso\n' + | ||
'// Distributed under MIT license\n' + | ||
'//\n' + | ||
'// <%= pkg.repository.url %>\n' + | ||
'\n' | ||
}, | ||
uglify: { | ||
options: { | ||
banner: '<%= meta.banner %>' | ||
}, | ||
build: { | ||
src: 'src/<%= pkg.name %>.js', | ||
dest: 'dist/<%= pkg.name %>.min.js' | ||
} | ||
}, | ||
concat: { | ||
options: { | ||
banner: '<%= meta.banner %>' | ||
}, | ||
dist: { | ||
src: ['src/**/*.js'], | ||
dest: 'dist/<%= pkg.name %>.js' | ||
} | ||
}, | ||
mochaTest: { | ||
test: { | ||
options: { | ||
reporter: 'spec', | ||
mocha: require('mocha') | ||
}, | ||
src: ['spec/**/*.js'] | ||
} | ||
}, | ||
clean: ['dist'] | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-mocha-test'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-concat'); | ||
|
||
grunt.registerTask('default', ['uglify', 'concat', 'mochaTest']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// underscore.catenate | ||
// ------------------- | ||
// v0.1.0 | ||
// | ||
// Copyright (c) 2013-2014 Mateus Maso | ||
// Distributed under MIT license | ||
// | ||
// http://github.com/mateusmaso/underscore.catenate | ||
|
||
(function(root, factory) { | ||
|
||
if (typeof exports !== 'undefined') { | ||
var _ = require('underscore'); | ||
if (typeof module !== 'undefined' && module.exports) | ||
module.exports = factory(_); | ||
exports = factory(_); | ||
} else { | ||
root._.mixin(factory(root._)); | ||
} | ||
|
||
}(this, function(_) { | ||
|
||
return { | ||
catenate: function() { | ||
var methods = arguments; | ||
|
||
return function() { | ||
var output; | ||
var context = this; | ||
var catenateArguments = arguments; | ||
|
||
_.each(methods, function(method) { | ||
if (method) { | ||
output = method.apply(context, catenateArguments); | ||
} | ||
}); | ||
|
||
return output; | ||
} | ||
} | ||
}; | ||
|
||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// underscore.catenate | ||
// ------------------- | ||
// v0.1.0 | ||
// | ||
// Copyright (c) 2013-2014 Mateus Maso | ||
// Distributed under MIT license | ||
// | ||
// http://github.com/mateusmaso/underscore.catenate | ||
|
||
!function(a,b){if("undefined"!=typeof exports){var c=require("underscore");"undefined"!=typeof module&&module.exports&&(module.exports=b(c)),exports=b(c)}else a._.mixin(b(a._))}(this,function(a){return{catenate:function(){var b=arguments;return function(){var c,d=this,e=arguments;return a.each(b,function(a){a&&(c=a.apply(d,e))}),c}}}}); |
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "underscore.catenate", | ||
"description": "Underscore helper for merging functions in the same context", | ||
"version": "0.1.0", | ||
"author": "mateusmaso", | ||
"keywords": ["underscore", "javascript", "catenate"], | ||
"devDependencies": { | ||
"chai": "*", | ||
"mocha": "*", | ||
"underscore": "~1.5.0", | ||
"grunt": "~0.4.5", | ||
"grunt-mocha-test": "~0.11.0", | ||
"grunt-contrib-concat": "~0.5.0", | ||
"grunt-contrib-uglify": "~0.5.0" | ||
}, | ||
"licenses": [{ | ||
"type": "MIT", | ||
"url": "https://github.com/mateusmaso/underscore.catenate/blob/master/LICENSE.txt" | ||
}], | ||
"repository": { | ||
"type" : "git", | ||
"url": "http://github.com/mateusmaso/underscore.catenate" | ||
}, | ||
"dependencies": { | ||
"underscore": "~1.5.0" | ||
}, | ||
"scripts": { | ||
"test": "grunt mochaTest" | ||
}, | ||
"main": "dist/underscore.catenate.js" | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var chai = require("chai"); | ||
var _ = require("underscore"); | ||
_.mixin(require('../src/underscore.catenate')); | ||
|
||
describe("underscore.catenate", function() { | ||
it("should catenate methods", function() { | ||
var value = ""; | ||
|
||
var fooBar = _.catenate(function() { | ||
return value += "foo"; | ||
}, function() { | ||
return value += "Bar"; | ||
}); | ||
|
||
chai.expect(fooBar()).to.equal("fooBar"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(function(root, factory) { | ||
|
||
if (typeof exports !== 'undefined') { | ||
var _ = require('underscore'); | ||
if (typeof module !== 'undefined' && module.exports) | ||
module.exports = factory(_); | ||
exports = factory(_); | ||
} else { | ||
root._.mixin(factory(root._)); | ||
} | ||
|
||
}(this, function(_) { | ||
|
||
return { | ||
catenate: function() { | ||
var methods = arguments; | ||
|
||
return function() { | ||
var output; | ||
var context = this; | ||
var catenateArguments = arguments; | ||
|
||
_.each(methods, function(method) { | ||
if (method) { | ||
output = method.apply(context, catenateArguments); | ||
} | ||
}); | ||
|
||
return output; | ||
} | ||
} | ||
}; | ||
|
||
})); |