Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
101 additions
and
95 deletions.
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 |
---|---|---|
@@ -1 +1 @@ | ||
export const KEY_INTERNAL = new Set("String", "Number"); | ||
export const KEY_INTERNAL = new Set(["String", "Number"]); |
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
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
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 |
---|---|---|
@@ -1,5 +1,47 @@ | ||
import CheddarString from '../String'; | ||
import HelperInit from '../../../../helpers/init'; | ||
|
||
function padItem(str) { | ||
let lines = str.split(/\r?\n/g); | ||
if (lines.length < 2) return str; | ||
|
||
for (var i = 1; i < lines.length; i++) { | ||
lines[i] = ' ' + lines[i]; | ||
} | ||
|
||
return lines.join("\n"); | ||
} | ||
|
||
export default new Map([ | ||
['String', (self) => { | ||
// Output strings without delimiter | ||
var string = ""; | ||
|
||
// From each key, obtain the string representation of both sides | ||
self.value.forEach((value, key) => { | ||
let [k, v] = [key, value].map( | ||
// Convert `item` to string representation | ||
// pad with 4 spaces then | ||
(item) => { | ||
// Get the primitive value | ||
let value; | ||
if (typeof item !== 'object' && typeof item !== 'function') { | ||
// Handle primitives | ||
value = typeof item == 'string' ? JSON.stringify(item) : item; | ||
} else { | ||
value = item.Cast && item.Cast.has("String") ? item.Cast.get("String")(item).value : `<${item.Name || item.constructor.Name}>`; | ||
} | ||
|
||
if (item instanceof self.constructor) return padItem(value); | ||
else return value; | ||
} | ||
); | ||
|
||
string += `\n ${k}: ${v}`; | ||
}); | ||
|
||
if (!string) return HelperInit(CheddarString, "[:]"); | ||
|
||
return HelperInit(CheddarString, `[${string}\n]`); | ||
}] | ||
]); |
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
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
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
This file was deleted.
Oops, something went wrong.
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