efcaf48b by Adam Heath

Initial set of files; spec hasn't been filled out yet.

1 parent 9b400f9e
.*.swp
.tmp/
bin/coverage/
dist/
node_modules/
src/lib/
.grunt/
_SpecRunner.html
// Generated on 2014-02-06 using generator-webapp 0.4.7
/* global module */
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
/* global require */
'use strict';
var config = {};
config.base = 'src';
config.jshint = {
options: {
},
browserOptions: {
},
};
config.jscs = {
options: {
validateIndentation: 4,
reporter: 'console',
maxErrors: -1,
},
};
config.bower = {
directory: 'lib/bower',
};
config.jasmine = {
withCoverage: true,
};
var montyPython = require('grunt-monty-python')(grunt);
montyPython.createConfig(config);
};
{
"name": "backbone-is-required",
"version": "2016.08.05-0",
"authors": [
"Adam Heath <doogie@brainfood.com>"
],
"main": [
"src/scripts/backbone-is-required.js"
],
"private": true,
"ignore": [
"**/.*",
"node_modules",
"src/lib"
],
"dependencies": {
"underscore": "",
"backbone": "",
"requirejs": ""
}
}
{
"name": "backbone-seen",
"version": "2016.08.05-0",
"main": [
"src/scripts/backbone-is-required.js"
],
"dependencies": {
"underscore": "",
"backbone": "",
"requirejs": ""
},
"devDependencies": {
"bower-requirejs": "",
"grunt": "",
"grunt-monty-python": "git+http://gitlab.brainfood.com/brainfood/grunt-monty-python.git"
},
"engines": {
"node": ">=0.8.0"
}
}
define(function(require) {
'use strict';
var _ = require('underscore');
var Backbone = require('backbone');
function wrapMethod(MethodHolder, methodName, methodCreator) {
MethodHolder[methodName] = methodCreator(methodName, MethodHolder[methodName]);
}
Backbone.isRequiredMixin = function(ModelClass) {
wrapMethod(ModelClass.prototype, 'toJSON', function(methodName, origMethod) {
return function(options) {
var data = origMethod.apply(this, arguments);
delete data._isRequired;
return data;
};
});
wrapMethod(ModelClass.prototype, 'parse', function(methodName, origMethod) {
return function(data, options) {
data = _.clone(data);
delete data._isRequired;
return origMethod.apply(this, arguments);
};
});
wrapMethod(ModelClass.prototype, 'initialize', function(methodName, origMethod) {
return function(data, options) {
origMethod.apply(this, arguments);
if (data && data._isRequired !== undefined) {
this.set('_isRequired', data._isRequired);
}
};
});
return ModelClass;
};
Backbone.isRequiredMixin.validationChecker = function() {
return this.get('_isRequired');
};
});
define(function(require) {
'use strict';
var BackboneIsRequired = require('backbone-is-required');
var Backbone = require('backbone');
/*
describe('BackboneIsRequired', function() {
it('exists', function() {
expect(BackboneIsRequired).toBeTruthy();
expect(Backbone.Model.prototype.seen).toBeUndefined();
});
});
*/
});
/* global require:true */
var require;
require = (function() {
'use strict';
var require = {
baseUrl: 'scripts',
paths: {
backbone: '../lib/bower/backbone/backbone',
underscore: '../lib/bower/underscore/underscore',
},
};
return require;
})();
/* global require */
require(
[],
function() {
'use strict';
}
);