@@ -27,6 +27,51 @@ var ndarraylike2ndarray = require( './../../../base/ndarraylike2ndarray' );
2727var numel = require ( './../../../numel' ) ;
2828
2929
30+ // FUNCTIONS //
31+
32+ /**
33+ * Returns an accessor for returning the value associated with a label.
34+ *
35+ * @private
36+ * @param {Collection } arr - input array
37+ * @returns {Function } accessor
38+ */
39+ function getValue ( arr ) {
40+ return get ;
41+
42+ /**
43+ * Returns the value associated with a label.
44+ *
45+ * @private
46+ * @returns {* } result
47+ */
48+ function get ( ) {
49+ return arr . get ( this . _i ) ; // eslint-disable-line no-invalid-this
50+ }
51+ }
52+
53+ /**
54+ * Returns an accessor for setting the value associated with a label.
55+ *
56+ * @private
57+ * @param {Collection } arr - input array
58+ * @returns {Function } accessor
59+ */
60+ function setValue ( arr ) {
61+ return set ;
62+
63+ /**
64+ * Sets the value associated with a label.
65+ *
66+ * @private
67+ * @param {* } value - value to set
68+ */
69+ function set ( value ) {
70+ arr . set ( this . _i , value ) ; // eslint-disable-line no-invalid-this
71+ }
72+ }
73+
74+
3075// MAIN //
3176
3277/**
@@ -111,7 +156,7 @@ function zip2views1d( arrays, labels ) {
111156 * @param {NonNegativeInteger } i - element index
112157 * @returns {Datum } datum instance
113158 */
114- function Datum ( i ) {
159+ function Datum ( i ) { // eslint-disable-line stdlib/no-unnecessary-nested-functions
115160 setNonEnumerableReadOnly ( this , '_i' , i ) ;
116161 return this ;
117162 }
@@ -132,48 +177,6 @@ function zip2views1d( arrays, labels ) {
132177 }
133178 return out ;
134179
135- /**
136- * Returns an accessor for returning the value associated with a label.
137- *
138- * @private
139- * @param {Collection } arr - input array
140- * @returns {Function } accessor
141- */
142- function getValue ( arr ) {
143- return get ;
144-
145- /**
146- * Returns the value associated with a label.
147- *
148- * @private
149- * @returns {* } result
150- */
151- function get ( ) {
152- return arr . get ( this . _i ) ; // eslint-disable-line no-invalid-this
153- }
154- }
155-
156- /**
157- * Returns an accessor for setting the value associated with a label.
158- *
159- * @private
160- * @param {Collection } arr - input array
161- * @returns {Function } accessor
162- */
163- function setValue ( arr ) {
164- return set ;
165-
166- /**
167- * Sets the value associated with a label.
168- *
169- * @private
170- * @param {* } value - value to set
171- */
172- function set ( value ) {
173- arr . set ( this . _i , value ) ; // eslint-disable-line no-invalid-this
174- }
175- }
176-
177180 /**
178181 * Serializes a datum to JSON.
179182 *
0 commit comments