/
es6pakket.mjs
339 lines (286 loc) · 8.76 KB
/
es6pakket.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
/*! ****************************************************************************
* ES6Pakket v2.1.2
*
* A boilerplate for building Javascript ES6 libraries with Pakket.
* (you can download it from npm or github repositories)
* Copyright (c) 2024 Mobilabs <contact@mobilabs.fr> (https://www.mobilabs.fr).
* Released under the MIT license. You may obtain a copy of the License
* at: http://www.opensource.org/licenses/mit-license.php).
* Built from {{boiler:name}} v{{boiler:name:version}}.
* ************************************************************************** */
/*! Generated by Pakket v1.2.1 */
/* global define */
/* eslint no-shadow: ['error', { 'allow': ['root'] }] */
/* eslint strict: ["error", "function"] */
const $__ES6GLOB = {};
(function(root, factory) {
'use strict';
/* c8 ignore start */
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([''], factory);
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
/* eslint-disable-next-line no-param-reassign */
module.exports = factory(root);
} else {
// Browser globals.
/* eslint-disable-next-line no-param-reassign */
root.ES6Pakket = factory(root);
}
/* c8 ignore stop */
/* eslint-disable-next-line */
}($__ES6GLOB,(root)=>{"use strict";return function(){/* istanbul ignore next */function e(t,n,o){function r(f){function i(e){const n=t[f][2][e];return r(n||e)}if(!n[f]){if(!t[f]){throw new Error(`Cannot find module "${f}"`)}n[f]={exports:{}};const r=n[f];t[f][1].call(r.exports,i,r,r.exports,e,t,n,o)}return n[f].exports}for(let e=0;e<o.length;e++){r(o[e])}return r}return e}()({
/* eslint-disable-next-line no-unused-vars */
1: ['./src/prototypal', function(impoort, module, exports) {
/** ************************************************************************
*
* A ...
*
* prototypal.js is built upon the Prototypal Instantiation pattern. It
* returns an object by calling its constructor. It doesn't use the new
* keyword.
*
* Private Functions:
* . none,
*
*
* Constructor:
* . ES6Pakket creates and returns the ES6Pakket object,
*
*
* Private Static Methods:
* . _setTestMode returns internal objects for testing purpose,
*
*
* Public Static Methods:
* . noConflict returns a reference to this ES6Pakket object,
*
*
* Public Methods:
* . whoami returns the library name and version,
* . getString returns a string,
* . getArray returns an array,
*
*
*
* @namespace -
* @dependencies none
* @exports -
* @author -
* @since 0.0.0
* @version -
* ********************************************************************** */
/* - */
/* eslint-disable one-var, semi-style, no-underscore-dangle */
// -- Vendor Modules
// -- Local Modules
const Util = impoort('./util/util');
// -- Local Constants
// Saves the previous value of the library variable, so that it can be
// restored later on, if noConflict is used.
const previousES6Pakket = root.ES6Pakket
;
// -- Local Variables
let methods
;
// -- Public ---------------------------------------------------------------
/**
* Returns the ES6Pakket object.
* (Prototypal Instantiation Pattern)
*
* @constructor ()
* @public
* @param {} -,
* @returns {Object} returns the ES6Pakket object,
* @since 0.0.0
*/
const ES6Pakket = function() {
const obj = Object.create(methods);
obj._library = {
name: 'ES6Pakket',
version: '2.1.2',
};
return obj;
};
// Attaches constants to ES6Pakket that provide name and version of the lib.
ES6Pakket.NAME = 'ES6Pakket';
ES6Pakket.VERSION = '2.1.2';
// -- Private Static Methods -----------------------------------------------
/**
* Returns the internal objects for testing purpose.
* (must not be deleted)
*
* @method ()
* @private
* @param {} -,
* @returns {Object} returns a list of internal objects,
* @since 0.0.0
*/
ES6Pakket._setTestMode = function() {
return [];
};
// -- Public Static Methods ------------------------------------------------
/**
* Returns a reference to this ES6Pakket object.
* (must not be deleted)
*
* Nota:
* Running ES6Pakket in noConflict mode, returns the ES6Pakket variable to
* its previous owner.
*
* @method ()
* @public
* @param {} -,
* @returns {Object} returns the ES6Pakket object,
* @since 0.0.0
*/
ES6Pakket.noConflict = function() {
/* eslint-disable-next-line no-param-reassign */
root.ES6Pakket = previousES6Pakket;
return this;
};
// -- Public Methods -------------------------------------------------------
methods = {
/**
* Returns the library name and version.
* (must not be deleted)
*
* @method ()
* @public
* @param {} -,
* @returns {Object} returns the library name and version,
* @since 0.0.0
*/
whoami() {
return this._library;
},
/**
* Returns a string.
* (must be deleted)
*
* @method ()
* @public
* @param {} -,
* @returns {String} returns a string,
* @since 0.0.0
*/
getString() {
return Util.getString();
},
/**
* Returns an array.
* (must be deleted)
*
* @method ()
* @public
* @param {} -,
* @returns {Array} returns an array,
* @since 0.0.0
*/
getArray() {
return Util.getArray();
},
};
// -- Export
/* eslint-disable-next-line no-param-reassign */
module.exports = ES6Pakket;
/* eslint-enable one-var, semi-style, no-underscore-dangle */
/* eslint-disable-next-line */
}, { './util/util': 2 }],
/* eslint-disable-next-line no-unused-vars */
2: ['./src/util/util', function(impoort, module, exports) {
/** ************************************************************************
*
* A ...
*
* util.js is just a literal object that contains a set of functions.
* It can't be instantiated.
*
* Private Functions:
* . _getString returns a string,
* . _getArray returns an array,
*
*
* Public Static Methods:
* . getString returns a string,
* . getArray returns an array,
*
*
*
* @namespace -
* @dependencies none
* @exports -
* @author -
* @since 0.0.0
* @version -
* ********************************************************************** */
/* - */
/* eslint-disable no-underscore-dangle */
// -- Vendor Modules
// -- Local Modules
// -- Local Constants
// -- Local Variables
// -- Private Functions ----------------------------------------------------
/**
* Returns a string.
*
* @function ()
* @private
* @param {} -,
* @returns {String} returns a string,
* @since 0.0.0
*/
function _getString() {
return 'I am a string!';
}
/**
* Returns an array.
*
* @function ()
* @private
* @param {} -,
* @returns {Array} returns an array,
* @since 0.0.0
*/
function _getArray() {
return [1, 2, 3];
}
// -- Public Static Methods ------------------------------------------------
const Util = {
/**
* Returns a string.
*
* @method ()
* @public
* @param {} -,
* @returns {String} returns a string,
* @since 0.0.0
*/
getString() {
return _getString();
},
/**
* Returns an array.
*
* @method ()
* @public
* @param {} -,
* @returns {Array} returns an array,
* @since 0.0.0
*/
getArray() {
return _getArray();
},
};
// -- Export
/* eslint-disable-next-line no-param-reassign */
module.exports = Util;
/* eslint-enable no-underscore-dangle */
}, {}],
/* eslint-disable-next-line */
},{},[1])(1)}));
// -- Export
export default $__ES6GLOB.ES6Pakket;