Socket
Socket
Sign inDemoInstall

@awesomeeng/awesome-utils

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@awesomeeng/awesome-utils - npm Package Compare versions

Comparing version 1.4.8 to 1.4.9

CODE_OF_CONDUCT.md

7

.eslintrc.js

@@ -6,3 +6,3 @@ "use strict";

parserOptions: {
ecmaVersion: 2018
ecmaVersion: 8
},

@@ -14,6 +14,2 @@ env: {

},
globals: {
Atomics: true,
SharedArrayBuffer: true
},
rules: {

@@ -23,2 +19,3 @@ "no-self-assign": [

],
"no-async-promise-executor": "off",
indent: [

@@ -25,0 +22,0 @@ "error",

@@ -98,3 +98,3 @@ ## Classes

### dateUtils.DAYS_OF_WEEK
### dateUtils.DAYS\_OF\_WEEK
Returns an array of the days of the week, in english.

@@ -108,3 +108,3 @@

### dateUtils.DAYS_OF_WEEK3
### dateUtils.DAYS\_OF\_WEEK3
Returns an array of the shortened 3 character days of the week, in english.

@@ -118,3 +118,3 @@

### dateUtils.DAYS_OF_WEEK2
### dateUtils.DAYS\_OF\_WEEK2
Returns an array of the shortened 2 character days of the week, in english.

@@ -147,8 +147,3 @@

### dateUtils.floor(date, to) ⇒ <code>Date</code>
Given some date, floor it to the nearest `to` argument, where `to` is some
number of milliseconds. For example, to floor to the nearest minute you
would do `floor(date,60000)` where `60000` is the number of milliseconds in
a single date. You can use this in conjunction with `SECOND`, `MINUTE`,
`HOUR`, and `DAY`. See also `floorSecond()`, `floorMinute()`, `floorHour()`,
and `floorDay()` below.
Given some date, floor it to the nearest `to` argument, where `to` is some number of milliseconds. For example, to floor to the nearest minute you would do `floor(date,60000)` where `60000` is the number of milliseconds in a single date. You can use this in conjunction with `SECOND`, `MINUTE`, `HOUR`, and `DAY`. See also `floorSecond()`, `floorMinute()`, `floorHour()`, and `floorDay()` below.

@@ -224,9 +219,4 @@ **Kind**: instance method of [<code>DateUtils</code>](#DateUtils)

### dateUtils.from(date) ⇒ <code>Date</code>
Given some date or date line object, return a Date object. This allows
you to quickly move between different types of date like objects. It
will parse nubmers as a unix epoch, a string of numbers as a unix epoch,
JS Date object as a Date Object, or a String as a `Date.parse()` call.
Given some date or date line object, return a Date object. This allows you to quickly move between different types of date like objects. It will parse nubmers as a unix epoch, a string of numbers as a unix epoch, JS Date object as a Date Object, or a String as a `Date.parse()` call. Basically, it does its best to retunr a Date Object or an exception.
Basically, it does its best to retunr a Date Object or an exception.
**Kind**: instance method of [<code>DateUtils</code>](#DateUtils)

@@ -258,44 +248,4 @@

### dateUtils.format(date, pattern) ⇒ <code>string</code>
Format a given date using a given pattern. Patterns are built using the following chart similar to
how momentjs, datejs, php strftime, Java SimpleDateFormat, etc.
Format a given date using a given pattern. Patterns are built using the following chart similar to how momentjs, datejs, php strftime, Java SimpleDateFormat, etc. You use one or more of the patterns from above to create a pattern. You may also use literals in your pattern like `YYYYMMDD'T'HHMMSSSSS'ZULU'` where both 'T' and 'ZULU' are literals and are inserted verbatim. | Pattern | Substitution | Example against July 20, 1969, 20:18:04.017 UTC | |---------|------------------------------------------|-------------------------------------------------| | YY | 2 digit year. | 69 | | YYYY | 4 digit year. | 1969 | | M | numeric month, not zero filled. | 7 | | MM | numeric month, zero filled. | 07 | | MMM | shortened 3 character month name. | Jul | | MMMM | full month name | July | | D | numeric day of month, not zero filled. | 20 | | DD | numeric day of month, zero filled. | 20 | | DDD | numeric day of year, not zero filled. | 200 | | DDDD | numeric day of year, zero filled. | 200 | | d | numeric day of the week (0=sunday). | 0 | | dd | shortened 2 character day of the week | Su | | ddd | shortened 3 character day of the week | Sun | | dddd | full textual day of the week | Sunday | | A | AM or PM. | PM | | a | am or pm. | pm | | H | 24 0 based hour of day, not zero filled. | 20 | | HH | 24 0 based hour of day, zero filled. | 20 | | h | 12 hour of day, not zero filled. | 8 | | hh | 12 hour of day, zero filled. | 8 | | k | 24 1 based hour of day, not zero filled. | 21 | | kk | 24 1 based hour of day, zero filled. | 21 | | m | minute of hour, not zero filled. | 18 | | mm | minute of hour, zero filled. | 18 | | s | second of minute, not zero filled. | 4 | | ss | second of minute, zero filled. | 04 | | S | milliseconds of second, not zero filled. | 17 | | SSS | milliseconds of second, zero filled. | 017 | | z | textual time zone | UTC | | Z | relative time zone with separator | -00:00 | | ZZ | relative time zone without separator | -0000 | | X | unix timestamp (seconds) | -14182916 | | x | unix timestamp (milliseconds) | -14182916000 |
You use one or more of the patterns from above to create a pattern. You may also use literals in your
pattern like `YYYYMMDD'T'HHMMSSSSS'ZULU'` where both 'T' and 'ZULU' are literals and are inserted verbatim.
| Pattern | Substitution | Example against July 20, 1969, 20:18:04.017 UTC |
|---------|------------------------------------------|-------------------------------------------------|
| YY | 2 digit year. | 69 |
| YYYY | 4 digit year. | 1969 |
| M | numeric month, not zero filled. | 7 |
| MM | numeric month, zero filled. | 07 |
| MMM | shortened 3 character month name. | Jul |
| MMMM | full month name | July |
| D | numeric day of month, not zero filled. | 20 |
| DD | numeric day of month, zero filled. | 20 |
| DDD | numeric day of year, not zero filled. | 200 |
| DDDD | numeric day of year, zero filled. | 200 |
| d | numeric day of the week (0=sunday). | 0 |
| dd | shortened 2 character day of the week | Su |
| ddd | shortened 3 character day of the week | Sun |
| dddd | full textual day of the week | Sunday |
| A | AM or PM. | PM |
| a | am or pm. | pm |
| H | 24 0 based hour of day, not zero filled. | 20 |
| HH | 24 0 based hour of day, zero filled. | 20 |
| h | 12 hour of day, not zero filled. | 8 |
| hh | 12 hour of day, zero filled. | 8 |
| k | 24 1 based hour of day, not zero filled. | 21 |
| kk | 24 1 based hour of day, zero filled. | 21 |
| m | minute of hour, not zero filled. | 18 |
| mm | minute of hour, zero filled. | 18 |
| s | second of minute, not zero filled. | 4 |
| ss | second of minute, zero filled. | 04 |
| S | milliseconds of second, not zero filled. | 17 |
| SSS | milliseconds of second, zero filled. | 017 |
| z | textual time zone | UTC |
| Z | relative time zone with separator | -00:00 |
| ZZ | relative time zone without separator | -0000 |
| X | unix timestamp (seconds) | -14182916 |
| x | unix timestamp (milliseconds) | -14182916000 |
**Kind**: instance method of [<code>DateUtils</code>](#DateUtils)

@@ -361,12 +311,4 @@

### moduleUtils.unrequire(mod, [removeChildren]) ⇒ <code>number</code>
Removes a module from the require cache, thus making it
reload again if required. Also, any children that
were loaded by the given module are also removed.
Removes a module from the require cache, thus making it reload again if required. Also, any children that were loaded by the given module are also removed. Returns the total number of modules removed. You may optional indicate if the unrequire should remove dependant children as well. This can have unwanted side-effects so use with caution.
Returns the total number of modules removed.
You may optional indicate if the unrequire should remove
dependant children as well. This can have unwanted side-effects
so use with caution.
**Kind**: instance method of [<code>ModuleUtils</code>](#ModuleUtils)

@@ -385,10 +327,4 @@

### moduleUtils.moduleSource(depth) ⇒ <code>string</code>
Returns the filename of the code that called this function.
This works by throwing and catching an exception and then reading the stack
trace of the exception and finding the info it needs.
Returns the filename of the code that called this function. This works by throwing and catching an exception and then reading the stack trace of the exception and finding the info it needs. *depth* specifies how far back into the stack we should go. So if you want the caller of this function, set it to 0 (or omit it). If you want the caller of the caller of this function, set it to 1. etc.
*depth* specifies how far back into the stack we should go. So if you want
the caller of this function, set it to 0 (or omit it). If you want the
caller of the caller of this function, set it to 1. etc.
**Kind**: instance method of [<code>ModuleUtils</code>](#ModuleUtils)

@@ -406,8 +342,4 @@

### moduleUtils.moduleStack(mod, [start], [end]) ⇒ <code>Array.&lt;String&gt;</code>
Returns the module require stack for the given module. That is, how
was the given module imported (required) into the current execution.
Returns the module require stack for the given module. That is, how was the given module imported (required) into the current execution. This returns an array of strings, which are the module ancestor module.id values.
This returns an array of strings, which are the module
ancestor module.id values.
**Kind**: instance method of [<code>ModuleUtils</code>](#ModuleUtils)

@@ -446,4 +378,3 @@

### objectUtils.isPlainObject(obj) ⇒ <code>Boolean</code>
Returns true oif the given object is a "plain" javascript object, meaning it
doesnt inherit from some other type of js object like an array, date, error, etc.
Returns true oif the given object is a "plain" javascript object, meaning it doesnt inherit from some other type of js object like an array, date, error, etc.

@@ -477,4 +408,3 @@ **Kind**: instance method of [<code>ObjectUtils</code>](#ObjectUtils)

### objectUtils.deepFreeze(obj) ⇒ <code>void</code>
Call Object.freeze() on the object and each property of the
object, essentially freezing the entire structure.
Call Object.freeze() on the object and each property of the object, essentially freezing the entire structure.

@@ -576,4 +506,3 @@ **Kind**: instance method of [<code>ObjectUtils</code>](#ObjectUtils)

### promiseUtils.sleep(duration) ⇒ <code>Promise</code>
Creates a promise that resolves after n milliseconds. Great for usage
with await for delaying some period of time.
Creates a promise that resolves after n milliseconds. Great for usage with await for delaying some period of time.

@@ -592,11 +521,4 @@ **Kind**: instance method of [<code>PromiseUtils</code>](#PromiseUtils)

### promiseUtils.series(array, f) ⇒ <code>Promise</code>
Execute the given function for each cell of the array, in series order.
If the given function returns a Promise, the promise will await resolution
before the function is called next. This creates a series execution of
an array of Promise executions. On a reject, all remaining executions
are skipped.
Execute the given function for each cell of the array, in series order. If the given function returns a Promise, the promise will await resolution before the function is called next. This creates a series execution of an array of Promise executions. On a reject, all remaining executions are skipped. The given function is called with the signature f(item,index,originalArray,resultsArray).
The given function is called with the signature
f(item,index,originalArray,resultsArray).
**Kind**: instance method of [<code>PromiseUtils</code>](#PromiseUtils)

@@ -615,10 +537,4 @@

### promiseUtils.timeout(promise, [ttl], [timeoutException]) ⇒ <code>Promise</code>
In essence this lets you wrap a promise in a timeout such that if the
timeout occurs before the promise resolves or reject, this rejects.
In essence this lets you wrap a promise in a timeout such that if the timeout occurs before the promise resolves or reject, this rejects. Returns a promise that will resolve/reject if the passed in promise resolves or rejects before the passed in ttl time has elapsed. If the ttl time does elsapse, the returned promise will reject (with the optional exception) and the passed in promise resolve or reject will be swallowed.
Returns a promise that will resolve/reject if the passed in promise resolves
or rejects before the passed in ttl time has elapsed. If the ttl time does
elsapse, the returned promise will reject (with the optional exception) and
the passed in promise resolve or reject will be swallowed.
**Kind**: instance method of [<code>PromiseUtils</code>](#PromiseUtils)

@@ -654,10 +570,4 @@

### vmUtils.executionLine(depth) ⇒ <code>number</code>
Returns the line number of the code of the line that called the line() function.
This works by throwing and catching an exception and then reading the stack
trace of the exception and finding the info it needs.
Returns the line number of the code of the line that called the line() function. This works by throwing and catching an exception and then reading the stack trace of the exception and finding the info it needs. *depth* specifies how far back into the stack we should go. So if you want the caller of this function, set it to 0 (or omit it). If you want the caller of the caller of this function, set it to 1. etc.
*depth* specifies how far back into the stack we should go. So if you want
the caller of this function, set it to 0 (or omit it). If you want the
caller of the caller of this function, set it to 1. etc.
**Kind**: instance method of [<code>VMUtils</code>](#VMUtils)

@@ -675,10 +585,4 @@

### vmUtils.executionSource(depth) ⇒ <code>string</code>
Returns the filename of the code that called this function.
This works by throwing and catching an exception and then reading the stack
trace of the exception and finding the info it needs.
Returns the filename of the code that called this function. This works by throwing and catching an exception and then reading the stack trace of the exception and finding the info it needs. *depth* specifies how far back into the stack we should go. So if you want the caller of this function, set it to 0 (or omit it). If you want the caller of the caller of this function, set it to 1. etc.
*depth* specifies how far back into the stack we should go. So if you want
the caller of this function, set it to 0 (or omit it). If you want the
caller of the caller of this function, set it to 1. etc.
**Kind**: instance method of [<code>VMUtils</code>](#VMUtils)

@@ -696,10 +600,4 @@

### vmUtils.executionSourceAndLine(depth) ⇒ <code>string</code>
Returns the filename and line number of the code that called this function.
This works by throwing and catching an exception and then reading the stack
trace of the exception and finding the info it needs.
Returns the filename and line number of the code that called this function. This works by throwing and catching an exception and then reading the stack trace of the exception and finding the info it needs. *depth* specifies how far back into the stack we should go. So if you want the caller of this function, set it to 0 (or omit it). If you want the caller of the caller of this function, set it to 1. etc.
*depth* specifies how far back into the stack we should go. So if you want
the caller of this function, set it to 0 (or omit it). If you want the
caller of the caller of this function, set it to 1. etc.
**Kind**: instance method of [<code>VMUtils</code>](#VMUtils)

@@ -717,19 +615,4 @@

### vmUtils.executionStack([start], [end]) ⇒ <code>Array.&lt;Object&gt;</code>
Returns the currently running stack trace, as an array of objects (see below)
that describes where in the current execution stack the application
currently is.
Returns the currently running stack trace, as an array of objects (see below) that describes where in the current execution stack the application currently is. The returned array is comprised of stack entry objects which have the following shape: ``` entry = { entry: string - the full stack trace entry string method: the method name from the stack trace entry source: the filename the method is in line: the line number the execution is on position: the line position the execution is on } ```
The returned array is comprised of stack entry objects which
have the following shape:
```
entry = {
entry: string - the full stack trace entry string
method: the method name from the stack trace entry
source: the filename the method is in
line: the line number the execution is on
position: the line position the execution is on
}
```
**Kind**: instance method of [<code>VMUtils</code>](#VMUtils)

@@ -736,0 +619,0 @@

{
"name": "@awesomeeng/awesome-utils",
"version": "1.4.8",
"version": "1.4.9",
"author": "the awesome engineering company",

@@ -15,4 +15,4 @@ "license": "MIT",

"devDependencies": {
"jsdoc-to-markdown": "*",
"mocha": "*"
"jsdoc-to-markdown": "^5.0.2",
"mocha": "^6.2.1"
},

@@ -26,3 +26,3 @@ "optionalDependencies": {},

},
"description": "Javascript Utility functions for enterprise ready nodejs applications.",
"description": "Javascript Utility functions for enterprise nodejs applications.",
"directories": {

@@ -29,0 +29,0 @@ "doc": "docs",

# AwesomeUtils
Javascript Utility functions for Enterprise Ready nodejs applications
Javascript Utility functions for enterprise nodejs applications

@@ -39,4 +39,6 @@ ## Disclaimer

This product is maintained and supported by The Awesome Engineering Company. For support please [file an issue](./issues) or contact us via our Webiste at [https://awesomeeng.com](https://awesomeeng.com). We will do our best to respond to you in a timely fashion.
## License
AwesomeLog is released under the MIT License. Please read the [LICENSE](./LICENSE) file for details.
# AwesomeUtils Release Notes
#### **Version 1.4.9**
- Fixes minor error in FS.recursiveMkdir that would occur when running in linux.
#### **Version 1.4.8**

@@ -4,0 +8,0 @@

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ module.exports = {

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -77,2 +77,3 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

/* eslint-disable-next-line require-atomic-updates */
if (!fileObj.stat) fileObj.stat = await this.stat(fileObj.resolved);

@@ -155,3 +156,6 @@

let paths = path.split(/\//g);
paths.forEach((p,i)=>{
if (!p) return;
let before = paths.slice(0,i).join("/");

@@ -251,2 +255,3 @@ let filename = (before ? before+"/" : "")+p;

let stat = await this.stat(fileObj.resolved);
/* eslint-disable-next-line require-atomic-updates */
fileObj.stat = stat;

@@ -253,0 +258,0 @@ let dir = stat.isDirectory();

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -75,2 +75,3 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

if (result instanceof Promise) result = await result;
/* eslint-disable-next-line require-atomic-updates */
results[index] = result;

@@ -99,3 +100,3 @@

* @param {Promise} promise
* @param {number} [ttl=30000]
* @param {number} [ttl=30000]
* @param {Error} [timeoutException=new Error("Timed out.")]

@@ -102,0 +103,0 @@ * @return {Promise}

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

// (c) 2018, The Awesome Engineering Company, https://awesomeneg.com
/* global Atomics */
"use strict";

@@ -4,0 +6,0 @@

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

@@ -0,0 +0,0 @@ // (c) 2018, The Awesome Engineering Company, https://awesomeneg.com

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc