1 |
|
2 | (function() {
|
3 | var Component, Composed, Field, _,
|
4 | __hasProp = {}.hasOwnProperty,
|
5 | __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
6 |
|
7 | _ = require('underscore');
|
8 |
|
9 | Composed = require('./Composed');
|
10 |
|
11 | Component = require('./Component');
|
12 |
|
13 | Field = (function(_super) {
|
14 | __extends(Field, _super);
|
15 |
|
16 | function Field(raw, control) {
|
17 | this.raw = raw;
|
18 | this.control = control;
|
19 | this.length = this.raw.length;
|
20 | this.assign(Component);
|
21 | this.delimiter = this.control.components;
|
22 | return;
|
23 | }
|
24 |
|
25 | Field.prototype.getComponent = function(index) {
|
26 | return this.getPart(index);
|
27 | };
|
28 |
|
29 | Field.prototype.setVal = function(values) {
|
30 | return this.raw = _.map(values, function(value) {
|
31 | return [value];
|
32 | });
|
33 | };
|
34 |
|
35 | return Field;
|
36 |
|
37 | })(Composed);
|
38 |
|
39 | module.exports = Field;
|
40 |
|
41 | }).call(this);
|