@-0/utils
Advanced tools
Comparing version 0.2.78 to 0.2.79
export const stringify_fn = (x, indent) => JSON.stringify(x, (key, value) => { | ||
if (typeof value === "function") { | ||
return (value | ||
.toString() | ||
.replace(/\r?\n|\r/g, "") | ||
.replace(/\s\s+/g, " ") | ||
.slice(0, 12) + "..."); | ||
if (typeof value === 'function') { | ||
return value.toString() | ||
.replace(/\r?\n|\r/g, '') | ||
.replace(/\s\s+/g, ' ') | ||
.slice(0, 12) + '...'; | ||
} | ||
@@ -9,0 +8,0 @@ else { |
@@ -1,1 +0,1 @@ | ||
export declare const stringify_type: (x: any) => "THUNK" | "FUNCTION" | "PROMISE" | "OBJECT" | "type_str NOT FOUND"; | ||
export declare const stringify_type: (x: any) => "NULLARY" | "UNARY" | "BINARY" | "N-ARY" | "PROMISE" | "OBJECT" | "type_str NOT FOUND"; |
@@ -1,7 +0,11 @@ | ||
import { isObject, isFunction, isPromise } from "@thi.ng/checks"; | ||
import { isObject, isFunction, isPromise } from '@thi.ng/checks'; | ||
export const stringify_type = x => { | ||
if (isFunction(x) && x.length === 0) | ||
return "THUNK"; | ||
if (isFunction(x) && x.length > 0) | ||
return "FUNCTION"; | ||
return "NULLARY"; | ||
if (isFunction(x) && x.length === 1) | ||
return "UNARY"; | ||
if (isFunction(x) && x.length === 2) | ||
return "BINARY"; | ||
if (isFunction(x) && x.length > 2) | ||
return "N-ARY"; | ||
if (isPromise(x)) | ||
@@ -8,0 +12,0 @@ return "PROMISE"; |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.2.78", | ||
"version": "0.2.79", | ||
"description": "utilities for the `-0` org/framework built on @thi.ng/umbrella ecosystem", | ||
@@ -34,3 +34,3 @@ "main": "./lib/index.js", | ||
"peerDependencies": { | ||
"@-0/keys": "^0.2.81", | ||
"@-0/keys": "^0.2.82", | ||
"@thi.ng/checks": "^2.8.0", | ||
@@ -41,3 +41,3 @@ "@thi.ng/rstream": "^5.1.0" | ||
"@babel/plugin-transform-modules-commonjs": "^7.12.1", | ||
"@-0/keys": "^0.2.81", | ||
"@-0/keys": "^0.2.82", | ||
"@thi.ng/checks": "^2.8.0", | ||
@@ -53,3 +53,3 @@ "@thi.ng/rstream": "^5.1.0", | ||
"prettier": "^2.2.1", | ||
"ts-jest": "^26.4.4" | ||
"ts-jest": "^26.5.0" | ||
}, | ||
@@ -56,0 +56,0 @@ "publishConfig": { |
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
11182
20
202