Skip to content

Commit

Permalink
More than just Object (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBuchholz committed Feb 26, 2019
1 parent 00d6294 commit 4fa6f16
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/define/class/standard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* @file Object Class definition
* @since 0.2.9
*/
/*#ifndef(UMD)*/
"use strict";
/*global _GpfClassDefinition*/ // Class definition
/*global _gpfDefineClassImported*/ // Base dictionary for all imported classes
/*global _gpfDefineEntitiesAdd*/ // Store the entity definition to be retreived later
/*global _gpfObjectForEach*/ // Similar to [].forEach but for objects
/*#endif*/

function _gpfDefineClassStandardGetDictionary (name) {
return Object.assign(Object.create(_gpfDefineClassImported), {
$name: name
});
}

function _gpfDefineClassStandardBuildEntityDefinition (InstanceBuilder, name) {
return Object.assign(new _GpfClassDefinition(_gpfDefineClassStandardGetDictionary(name)), {
_instanceBuilder: InstanceBuilder
});
}

function _gpfDefineClassStandardPatchDefinition (entityDefinition) {
Object.assign(entityDefinition, {
_extend: null,
_extendDefinition: null
});
}

function _gpfDefineClassStandardInstallEntityDefinition (InstanceBuilder, name) {
var entityDefinition = _gpfDefineClassStandardBuildEntityDefinition(InstanceBuilder, name);
_gpfDefineEntitiesAdd(entityDefinition);
entityDefinition.check();
_gpfDefineClassStandardPatchDefinition(entityDefinition);
}

_gpfDefineClassStandardInstallEntityDefinition(Object, "Object");
_gpfObjectForEach({
"Array": Array,
"Date": Date,
"Error": Error,
"Function": Function,
"Number": Number,
"RegExp": RegExp,
"String": String
}, _gpfDefineClassStandardInstallEntityDefinition);

0 comments on commit 4fa6f16

Please sign in to comment.