Page MenuHomeSealhub

field.js
No OneTemporary

field.js

"use strict";
const locreq = require("locreq")(__dirname);
const default_methods = require("./field-type-default-methods.js");
const FieldType = locreq("lib/chip-types/field-type.js");
function Field (declaration){
this.name = declaration.name;
this.declaration = declaration;
this.type = new FieldType(declaration.type);
this.required = declaration.required || false;
this.params = declaration.params || {};
const self = this;
for (const method_name in default_methods){
this[method_name] = (function(method_name){
return function(){
const arguments_array = Object.keys(arguments).map((key)=>arguments[key]);
arguments_array.splice(1, 0, self.params);
return self.type[method_name].apply(self.type, arguments_array);
};
})(method_name);
}
}
module.exports = Field;

File Metadata

Mime Type
text/plain
Expires
Mon, Jul 21, 00:27 (1 d, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
837603
Default Alt Text
field.js (802 B)

Event Timeline