@awesomeness-js/utils 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +23 -8
- package/package.json +1 -1
- package/src/getAllFiles.js +24 -0
- package/test.js +4 -0
package/index.js
CHANGED
|
@@ -4,17 +4,32 @@
|
|
|
4
4
|
* Do not edit manually.
|
|
5
5
|
*/
|
|
6
6
|
import _build from './src/build.js';
|
|
7
|
+
import _convertBytes from './src/convertBytes.js';
|
|
8
|
+
import _each from './src/each.js';
|
|
9
|
+
import _eachAsync from './src/eachAsync.js';
|
|
10
|
+
import _getAllFiles from './src/getAllFiles.js';
|
|
11
|
+
import _toPennies from './src/toPennies.js';
|
|
7
12
|
|
|
8
13
|
export { _build as build };
|
|
14
|
+
export { _convertBytes as convertBytes };
|
|
15
|
+
export { _each as each };
|
|
16
|
+
export { _eachAsync as eachAsync };
|
|
17
|
+
export { _getAllFiles as getAllFiles };
|
|
18
|
+
export { _toPennies as toPennies };
|
|
9
19
|
|
|
10
20
|
export default {
|
|
11
|
-
/**
|
|
12
|
-
* Generates a output file that consolidates all src functions.
|
|
13
|
-
*
|
|
14
|
-
* @param {Object} [options] - The options for generating the output file.
|
|
15
|
-
* @param {string} [options.src='./src'] - The source directory.
|
|
16
|
-
* @param {array} [options.dest=['./', 'index.js']] - The destination file.
|
|
17
|
-
* @returns {bool} - Returns true if the output file is generated successfully.
|
|
21
|
+
/**
|
|
22
|
+
* Generates a output file that consolidates all src functions.
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} [options] - The options for generating the output file.
|
|
25
|
+
* @param {string} [options.src='./src'] - The source directory.
|
|
26
|
+
* @param {array} [options.dest=['./', 'index.js']] - The destination file.
|
|
27
|
+
* @returns {bool} - Returns true if the output file is generated successfully.
|
|
18
28
|
*/
|
|
19
|
-
build: _build
|
|
29
|
+
build: _build,
|
|
30
|
+
convertBytes: _convertBytes,
|
|
31
|
+
each: _each,
|
|
32
|
+
eachAsync: _eachAsync,
|
|
33
|
+
getAllFiles: _getAllFiles,
|
|
34
|
+
toPennies: _toPennies
|
|
20
35
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
function getAllFiles(dirPath = './', arrayOfFiles = []){
|
|
5
|
+
|
|
6
|
+
const items = fs.readdirSync(dirPath);
|
|
7
|
+
|
|
8
|
+
items.forEach((item) => {
|
|
9
|
+
const fullPath = path.resolve(dirPath, item);
|
|
10
|
+
|
|
11
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
12
|
+
// Recurse into the directory
|
|
13
|
+
getAllFiles(fullPath, arrayOfFiles);
|
|
14
|
+
} else {
|
|
15
|
+
// Add only files
|
|
16
|
+
arrayOfFiles.push(fullPath);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return arrayOfFiles;
|
|
21
|
+
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default getAllFiles;
|
package/test.js
ADDED