-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Arinthros/130 fix quoted module names (#131)
* Check method name for encapslating quotes and remove them prior to createStringLiteral * Add semicolons per code format * Refactor for simpler string checking logic, normalize tab spaces * Add test for quoted module name * Update module_quoted tests per master changes * Replace tab with spaces * Fix parens and spacing format * Fix some spacing. Co-authored-by: Chad Engler <[email protected]>
- Loading branch information
Showing
4 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
declare module "1.0/array-to-object-keys" { | ||
/** | ||
* @param value - The original array entry | ||
* @param index - The index of the array entry (starts at 0) | ||
*/ | ||
type valueGenerator = (value: string, index: number) => any; | ||
/** | ||
* Converts an array to an object with static keys and customizable values | ||
* @example | ||
* arrayToObjectKeys(["a", "b"]) | ||
* // {a: null, b: null} | ||
* @example | ||
* arrayToObjectKeys(["a", "b"], "value") | ||
* // {a: "value", b: "value"} | ||
* @example | ||
* arrayToObjectKeys(["a", "b"], (key, index) => `value for ${key} #${index + 1}`) | ||
* // {a: "value for a #1", b: "value for b #2"} | ||
* @param array - Keys for the generated object | ||
* @param [valueGenerator = null] - Optional function that sets the object values based on key and index | ||
* @returns A generated object based on the array input | ||
*/ | ||
function arrayToObjectKeys(array: string[], valueGenerator?: valueGenerator | any): { | ||
[key: string]: any; | ||
}; | ||
/** | ||
* Export arrayToObjectKeys as default. | ||
*/ | ||
export default arrayToObjectKeys; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** @module "1.0/array-to-object-keys" */ | ||
|
||
/** | ||
* @typedef valueGenerator | ||
* @type {function} | ||
* @param {string} value The original array entry | ||
* @param {number} index The index of the array entry (starts at 0) | ||
* @returns {*} | ||
*/ | ||
|
||
/** | ||
* Converts an array to an object with static keys and customizable values | ||
* @example | ||
* arrayToObjectKeys(["a", "b"]) | ||
* // {a: null, b: null} | ||
* @example | ||
* arrayToObjectKeys(["a", "b"], "value") | ||
* // {a: "value", b: "value"} | ||
* @example | ||
* arrayToObjectKeys(["a", "b"], (key, index) => `value for ${key} #${index + 1}`) | ||
* // {a: "value for a #1", b: "value for b #2"} | ||
* @param {string[]} array Keys for the generated object | ||
* @param {valueGenerator|*} [valueGenerator=null] Optional function that sets the object values based on key and index | ||
* @returns {Object<string, *>} A generated object based on the array input | ||
*/ | ||
const arrayToObjectKeys = (array, valueGenerator = null) => { | ||
} | ||
|
||
/** | ||
* Export arrayToObjectKeys as default. | ||
*/ | ||
export default arrayToObjectKeys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters