Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5a75384

Browse files
committedSep 14, 2018
Implementation (#288)
1 parent d3b9053 commit 5a75384

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
 

‎src/serial/get.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* @file Serializable properties helper
3+
*/
4+
/*#ifndef(UMD)*/
5+
"use strict";
6+
/*global _gpfAttributesGet*/ // Get attributes defined for the object / class
7+
/*global _gpfAttributesSerializable*/ // Shortcut for gpf.attributes.Serializable
8+
/*global _gpfObjectForEach*/ // Similar to [].forEach but for objects
9+
/*exported _gpfSerialGet*/ // Collect gpf.typedef.serializableProperty defined for the object / class
10+
/*#endif*/
11+
12+
/**
13+
* Collect {@link gpf.typedef.serializableProperty} defined for the object / class
14+
*
15+
* @param {Object|Function} objectOrClass Object instance or class constructor
16+
* @return {Object} Dictionary of {@link gpf.typedef.serializableProperty} index by member
17+
*/
18+
function _gpfSerialGet (objectOrClass) {
19+
var serializable = _gpfAttributesGet(objectOrClass, _gpfAttributesSerializable),
20+
properties = {};
21+
_gpfObjectForEach(serializable, function (attributes, member) {
22+
properties[member] = attributes[0].getProperty();
23+
});
24+
return properties;
25+
}
26+
27+
/** @gpf:sameas _gpfSerialGet*/
28+
gpf.serial.get = _gpfSerialGet;

0 commit comments

Comments
 (0)
Please sign in to comment.