@lbu/stdlib
Advanced tools
Comparing version 0.0.42 to 0.0.43
@@ -7,4 +7,3 @@ import { Logger } from "@lbu/insight"; | ||
* Return a new uuid v4 | ||
*/ | ||
(): string; | ||
*/ (): string; | ||
@@ -20,2 +19,7 @@ /** | ||
* Return a new uuid v4 | ||
* @example | ||
* ```js | ||
* uuid(); | ||
* // => f3283b08-08c4-43fc-9fa6-e36c0ab2b61a | ||
* ``` | ||
*/ | ||
@@ -27,2 +31,8 @@ export declare const uuid: UuidFunc; | ||
* status and other meta data directly | ||
* @example | ||
* ```js | ||
* new AppError(401, "error.server.unauthorized"); | ||
* AppError.validationError("validation.string.length", { message: "String should have at least 3 characters" }); | ||
* AppError.serverError({}, new Error("Oopsie")); | ||
* ``` | ||
*/ | ||
@@ -60,2 +70,7 @@ export class AppError<T extends any> extends Error { | ||
/** | ||
* Check if value contains the properties to at least act like a valid AppError | ||
*/ | ||
static instanceOf(value: unknown): value is AppError<unknown>; | ||
/** | ||
* Create a new 404 not found error | ||
@@ -87,2 +102,11 @@ */ | ||
* Check if item is null or undefined | ||
* @example | ||
* ```js | ||
* isNil(null); | ||
* // => true | ||
* isNil(undefined); | ||
* // => true | ||
* isNil({}); | ||
* // => false | ||
* ``` | ||
*/ | ||
@@ -96,2 +120,13 @@ export function isNil<T>( | ||
* Not completely bullet proof | ||
* @example | ||
* ```js | ||
* isPlainObject("foo"); | ||
* // => false | ||
* isPlainObject(new (class Foo {})); | ||
* // => false | ||
* isPlainObject([]); | ||
* // => false | ||
* isPlainObject({}); | ||
* // => true | ||
* ``` | ||
*/ | ||
@@ -104,2 +139,11 @@ export function isPlainObject(obj: any): boolean; | ||
* **Note:** This method mutates `object`. | ||
* @example | ||
* ```js | ||
* merge({}, {}); | ||
* // => {} | ||
* merge({}, { foo: true}); | ||
* // => { foo: true } | ||
* merge({ bar: 1 }, { bar: 2 }); | ||
* // => { bar: 2 } | ||
* ``` | ||
*/ | ||
@@ -110,2 +154,7 @@ export function merge(object: any, ...sources: any[]): any; | ||
* Flattens the given nested object, skipping anything that is not a plain object | ||
* @example | ||
* ```js | ||
* flatten({ foo: { bar: 2 } }); | ||
* // => { "foo.bar": 2 } | ||
* ``` | ||
*/ | ||
@@ -120,2 +169,7 @@ export function flatten( | ||
* Opposite of flatten | ||
* @example | ||
* ```js | ||
* unFlatten({ "foo.bar": 2}); | ||
* // => { foo: { bar: 2 } } | ||
* ``` | ||
*/ | ||
@@ -127,2 +181,3 @@ export function unFlatten(data?: { [keys: string]: any }): any; | ||
* | ||
* @example | ||
* ```js | ||
@@ -137,2 +192,7 @@ * camelToSnakeCase("fooBBar"); | ||
* Promisify version of child_process#exec | ||
* @example | ||
* ```js | ||
* exec("uname -m"); | ||
* // => Promise<{ stdout: "x86_64\n", stderr: "" }> | ||
* ``` | ||
*/ | ||
@@ -145,2 +205,7 @@ export function exec( | ||
* A promise wrapper around child_process#spawn | ||
* @example | ||
* ```js | ||
* spawn("ls", ["-al"], { cwd: "/home" }); | ||
* // => Promise<{ code: 0 }> | ||
* ``` | ||
*/ | ||
@@ -171,2 +236,3 @@ export function spawn( | ||
* Recursively walks directory async and calls cb on all files | ||
* | ||
*/ | ||
@@ -190,2 +256,7 @@ export function processDirectoryRecursive( | ||
* Reexport of path#join | ||
* @example | ||
* ```js | ||
* pathJoin("/foo", "bar"); | ||
* // => "/foo/bar" | ||
* ``` | ||
*/ | ||
@@ -252,3 +323,4 @@ export function pathJoin(...parts: string[]): string; | ||
/** | ||
* Compile all templates found in the provided directory with the provided extension synchronously | ||
* Compile all templates found in the provided directory with the provided extension | ||
* synchronously | ||
*/ | ||
@@ -255,0 +327,0 @@ export function compileTemplateDirectorySync( |
{ | ||
"name": "@lbu/stdlib", | ||
"version": "0.0.42", | ||
"version": "0.0.43", | ||
"description": "All kinds of utility functions", | ||
@@ -17,4 +17,4 @@ "main": "./index.js", | ||
"dependencies": { | ||
"@lbu/insight": "0.0.42", | ||
"@types/node": "14.0.14", | ||
"@lbu/insight": "0.0.43", | ||
"@types/node": "14.0.22", | ||
"dotenv": "8.2.0", | ||
@@ -29,3 +29,4 @@ "lodash.merge": "4.6.2" | ||
"type": "git", | ||
"url": "https://github.com/lightbasenl/lbu.git" | ||
"url": "ssh://git@github.com/lightbasenl/lbu.git", | ||
"directory": "packages/stdlib" | ||
}, | ||
@@ -38,3 +39,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "d6952b36179d22eaa725a636d962bebbee2ea15f" | ||
"gitHead": "f3b1d86fb7237f6bdc30f3499e0a383a0e0724da" | ||
} |
@@ -34,2 +34,15 @@ import { isNil } from "./lodash.js"; | ||
/** | ||
* @param {*} value | ||
* @returns {boolean} | ||
*/ | ||
static instanceOf(value) { | ||
return ( | ||
value && | ||
typeof value.key === "string" && | ||
typeof value.status === "number" && | ||
!!value.info | ||
); | ||
} | ||
/** | ||
* @param {object} [info={}] | ||
@@ -36,0 +49,0 @@ * @param {Error} [error] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30052
968
+ Added@lbu/insight@0.0.43(transitive)
+ Added@types/node@14.0.22(transitive)
- Removed@lbu/insight@0.0.42(transitive)
- Removed@types/node@14.0.14(transitive)
Updated@lbu/insight@0.0.43
Updated@types/node@14.0.22