@@ -7,12 +7,13 @@ const assign = Object.assign;
77
88/**
99 * Creates new factory instance.
10- * @param {object } descriptor The information about the object the factory will be creating.
10+ * @param {Descriptor } descriptor The information about the object the factory will be creating.
1111 * @returns {Function } The new factory function.
1212 */
1313function createFactory ( descriptor ) {
1414 return function Stamp ( options , ...args ) {
15- const obj = Object . create ( descriptor . methods || { } ) ;
15+ // Next line was optimized for most JS VMs. Please, be careful here!
16+ const obj = Object . create ( descriptor . methods || null ) ;
1617
1718 merge ( obj , descriptor . deepProperties ) ;
1819 assign ( obj , descriptor . properties ) ;
@@ -31,9 +32,9 @@ function createFactory(descriptor) {
3132
3233/**
3334 * Returns a new stamp given a descriptor and a compose function implementation.
34- * @param {object } [descriptor={}] The information about the object the stamp will be creating.
35- * @param {Function } composeFunction The "compose" function implementation.
36- * @returns {Function }
35+ * @param {Descriptor } [descriptor={}] The information about the object the stamp will be creating.
36+ * @param {Compose } composeFunction The "compose" function implementation.
37+ * @returns {Stamp }
3738 */
3839function createStamp ( descriptor , composeFunction ) {
3940 const Stamp = createFactory ( descriptor ) ;
@@ -53,9 +54,10 @@ function createStamp(descriptor, composeFunction) {
5354
5455/**
5556 * Mutates the dstDescriptor by merging the srcComposable data into it.
56- * @param {object } dstDescriptor The descriptor object to merge into.
57- * @param {object } [srcComposable] The composable (either descriptor or stamp) to merge data form.
58- * @returns {object } Returns the dstDescriptor argument.
57+ * @param {Descriptor } dstDescriptor The descriptor object to merge into.
58+ * @param {Composable } [srcComposable] The composable
59+ * (either descriptor or stamp) to merge data form.
60+ * @returns {Descriptor } Returns the dstDescriptor argument.
5961 */
6062function mergeComposable ( dstDescriptor , srcComposable ) {
6163 const srcDescriptor = ( srcComposable && srcComposable . compose ) || srcComposable ;
@@ -91,7 +93,8 @@ function mergeComposable(dstDescriptor, srcComposable) {
9193/**
9294 * Given the list of composables (stamp descriptors and stamps) returns
9395 * a new stamp (composable factory function).
94- * @param {...(object|Function) } [composables] The list of composables.
96+ * @typedef {Function } Compose
97+ * @param {...(Composable) } [composables] The list of composables.
9598 * @returns {Stamp } A new stamp (aka composable factory function)
9699 */
97100export default function compose ( ...composables ) {
@@ -125,3 +128,9 @@ export default function compose(...composables) {
125128 * @returns {* } Instantiated object
126129 * @property {Descriptor } compose - The Stamp descriptor and composition function
127130 */
131+
132+ /**
133+ * A composable object - stamp or descriptor
134+ * @typedef {Stamp|Descriptor } Composable
135+ */
136+
0 commit comments