@useparagon/whiskers-core
Advanced tools
Comparing version 0.0.1-canary.18 to 0.0.1-canary.19
@@ -1,5 +0,18 @@ | ||
export declare function prefixEnumValues<T extends { | ||
[key: string]: string; | ||
}>(enumObject: T, prefix: string): { | ||
[K in keyof T]: string; | ||
/** | ||
* Prefix and/or suffix enum values | ||
* | ||
* @example | ||
* | ||
* export enum SecretKeys { | ||
* NPM_TOKEN = 'NPM_TOKEN', | ||
* } | ||
* | ||
* export const Secrets = prefixSuffixEnumValues('secrets.', SecretKeys, ''); | ||
* | ||
* console.log(Secrets.NPM_TOKEN) // secrets.NPM_TOKEN | ||
*/ | ||
export declare function prefixSuffixEnumValues<TPrefix extends string, TSuffix extends string, TEnumKey extends string, TEnumValue extends string>(prefix: TPrefix, enumObj: { | ||
[key in TEnumKey]: string; | ||
}, suffix: TSuffix): { | ||
[key in TEnumKey]: `${TPrefix}${TEnumValue}${TSuffix}`; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.prefixEnumValues = void 0; | ||
// Helper object to prefix enum values | ||
function prefixEnumValues(enumObject, prefix) { | ||
return Object.keys(enumObject).reduce((acc, key) => { | ||
acc[key] = `${prefix}${enumObject[key]}`; | ||
return acc; | ||
exports.prefixSuffixEnumValues = void 0; | ||
/** | ||
* Prefix and/or suffix enum values | ||
* | ||
* @example | ||
* | ||
* export enum SecretKeys { | ||
* NPM_TOKEN = 'NPM_TOKEN', | ||
* } | ||
* | ||
* export const Secrets = prefixSuffixEnumValues('secrets.', SecretKeys, ''); | ||
* | ||
* console.log(Secrets.NPM_TOKEN) // secrets.NPM_TOKEN | ||
*/ | ||
function prefixSuffixEnumValues(prefix, enumObj, suffix) { | ||
return Object.keys(enumObj).reduce((aggregate, key) => { | ||
return { | ||
...aggregate, | ||
[key]: `${prefix}${enumObj[key]}${suffix}`, | ||
}; | ||
}, {}); | ||
} | ||
exports.prefixEnumValues = prefixEnumValues; | ||
exports.prefixSuffixEnumValues = prefixSuffixEnumValues; | ||
//# sourceMappingURL=enums.js.map |
@@ -10,1 +10,21 @@ /** | ||
export declare function deepMerge<A extends object, B extends object>(a: A, b: B): A & B; | ||
/** | ||
* Prefix and/or suffix enum values | ||
* | ||
* @example | ||
* | ||
* export const InputsConfig { | ||
* input_1: { | ||
* key: value | ||
* } | ||
* } | ||
* | ||
* export const Inputs = prefixSuffixObjectKeys('inputs.', InputsConfig, ''); | ||
* | ||
* console.log(InputRef.input_1) // inputs.input_1 | ||
*/ | ||
export declare function prefixSuffixObjectKeys<TPrefix extends string, TSuffix extends string, TEnumKey extends string>(prefix: TPrefix, obj: { | ||
[key in TEnumKey]: any; | ||
}, suffix: TSuffix): { | ||
[key in TEnumKey]: `${TPrefix}${TEnumKey}${TSuffix}`; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.deepMerge = exports.removeKeys = void 0; | ||
exports.prefixSuffixObjectKeys = exports.deepMerge = exports.removeKeys = void 0; | ||
/** | ||
@@ -33,2 +33,26 @@ * returns an object with the specified keys removed | ||
exports.deepMerge = deepMerge; | ||
/** | ||
* Prefix and/or suffix enum values | ||
* | ||
* @example | ||
* | ||
* export const InputsConfig { | ||
* input_1: { | ||
* key: value | ||
* } | ||
* } | ||
* | ||
* export const Inputs = prefixSuffixObjectKeys('inputs.', InputsConfig, ''); | ||
* | ||
* console.log(InputRef.input_1) // inputs.input_1 | ||
*/ | ||
function prefixSuffixObjectKeys(prefix, obj, suffix) { | ||
return Object.keys(obj).reduce((aggregate, key) => { | ||
return { | ||
...aggregate, | ||
[key]: `${prefix}${key}${suffix}`, | ||
}; | ||
}, {}); | ||
} | ||
exports.prefixSuffixObjectKeys = prefixSuffixObjectKeys; | ||
//# sourceMappingURL=objects.js.map |
{ | ||
"name": "@useparagon/whiskers-core", | ||
"version": "0.0.1-canary.18", | ||
"version": "0.0.1-canary.19", | ||
"bugs": "https://github.com/useparagon/whiskers/issues", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/useparagon/whiskers#readme", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
54891
1171
0