@arroyodev-llc/utils.projen
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -1,2 +0,3 @@ | ||
import { ObjectLiteralExpression, PropertyAssignment } from 'ts-morph'; | ||
import { ObjectLiteralExpression, PropertyAssignment, WriterFunction, Expression, ArrayLiteralExpression } from 'ts-morph'; | ||
import { Primitive, Schema } from 'type-fest'; | ||
import * as projen from 'projen'; | ||
@@ -20,2 +21,44 @@ import { Component, Project, TaskStep } from 'projen'; | ||
declare const addPropertyAssignmentsFromObject: <T extends object>(expression: ObjectLiteralExpression, obj: T) => PropertyAssignment[]; | ||
type Enumerable<T> = T | Array<T>; | ||
/** | ||
* Merge object acceptable key values. | ||
*/ | ||
type ObjectLiteralMergeObjectValue = WriterFunction | Enumerable<Primitive | Record<string, WriterFunction | Enumerable<Primitive>>>; | ||
/** | ||
* Create ObjectLiteral merge schema from type. | ||
*/ | ||
type ObjectLiteralMergeSchema<T> = Schema<T, ObjectLiteralMergeObjectValue> | T; | ||
/** | ||
* Ensure given value is a valid initializer. | ||
* @param value Input writer function or primitive value. | ||
*/ | ||
declare const convertInitializer: <T extends ObjectLiteralMergeObjectValue>(value: T) => WriterFunction | string; | ||
/** | ||
* Test equality between two expressions. | ||
* | ||
* @remarks | ||
* Converts both expressions to strings strips all whitespace, | ||
* quotations, and escapes. The resulting strings are then compared. | ||
* | ||
* @param a Left expression. | ||
* @param b Right expression. | ||
*/ | ||
declare const isExpressionEqual: (a: Expression | string, b: Expression | string) => boolean; | ||
/** | ||
* Merge array into {@link ArrayLiteralExpression}. | ||
* | ||
* @remarks | ||
* Produces a concat-ed array of unique elements. | ||
* Any writer functions will be added as-is. | ||
* | ||
* @param arrayLiteral {@link ArrayLiteralExpression} to merge into. | ||
* @param value Values to merge in array literal. | ||
*/ | ||
declare function mergeArrayLiteral(arrayLiteral: ArrayLiteralExpression, value: Array<Primitive | WriterFunction | ObjectLiteralMergeObjectValue>): (string | WriterFunction)[]; | ||
/** | ||
* Deeply merge `obj` into an existing {@link ObjectLiteralExpression} | ||
* @param expression {@link ObjectLiteralExpression} to merge into. | ||
* @param obj Input merge object. | ||
*/ | ||
declare function mergeObjectLiteral<T extends Record<string, any>>(expression: ObjectLiteralExpression, obj: Schema<T, ObjectLiteralMergeObjectValue>): void; | ||
@@ -63,2 +106,2 @@ /** | ||
export { ProjectName, addPropertyAssignmentsFromObject, applyOverrides, cwdRelativePath, findComponent, findRootProject, isComponent, replaceTask }; | ||
export { Enumerable, ObjectLiteralMergeObjectValue, ObjectLiteralMergeSchema, ProjectName, addPropertyAssignmentsFromObject, applyOverrides, convertInitializer, cwdRelativePath, findComponent, findRootProject, isComponent, isExpressionEqual, mergeArrayLiteral, mergeObjectLiteral, replaceTask }; |
@@ -23,3 +23,4 @@ { | ||
"typescript": "^5", | ||
"unbuild": "^1.2.1" | ||
"unbuild": "^1.2.1", | ||
"vitest": "^0.31.1" | ||
}, | ||
@@ -37,3 +38,3 @@ "dependencies": { | ||
}, | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"types": "./dist/index.d.ts", | ||
@@ -40,0 +41,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
31672
517
15