MCPcopy
hub / github.com/airbnb/react-sketchapp / generateID

Function generateID

src/jsonUtils/models.ts:47–62  ·  view source on GitHub ↗
(seed?: string, hardcoded?: boolean)

Source from the content-addressed store, hash-verified

45const previousSeeds: { [seed: string]: number } = {};
46
47export function generateID(seed?: string, hardcoded?: boolean): string {
48 let _seed = seed;
49
50 if (seed) {
51 if (!previousSeeds[seed]) {
52 previousSeeds[seed] = 0;
53 }
54 previousSeeds[seed] += 1;
55
56 if (!hardcoded) {
57 _seed = `${seed}${previousSeeds[seed]}`;
58 }
59 }
60
61 return e7(_seed);
62}
63
64const safeToLower = (input: Color): Color => {
65 if (typeof input === 'string') {

Callers 15

makeSymbolFunction · 0.90
addStyleMethod · 0.90
addStyleMethod · 0.90
renderBackingLayersMethod · 0.90
renderGroupLayerMethod · 0.90
makeShapePathFunction · 0.90
makeRectShapeLayerFunction · 0.90
makeShapeGroupFunction · 0.90
makeTextLayerFunction · 0.90
getArtboardFunction · 0.90
layerGroupFunction · 0.90
models.tsFile · 0.90

Calls 1

e7Function · 0.85

Tested by

no test coverage detected