efcaf48b by Adam Heath

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

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