Skip to content

Commit 7c41cf6

Browse files
committed
Revert renaming the *SJON functions
1 parent a6ddb65 commit 7c41cf6

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

src/jsonUtils/makeSvgLayer/index.sketch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FileFormat1 as FileFormat } from '@sketch-hq/sketch-file-format-ts';
2-
import convertSketchToJson from '../sketchJson/convertSketchToJson';
2+
import toSJSON from '../sketchJson/toSJSON';
33

44
import { LayoutInfo } from '../../types';
55

@@ -21,5 +21,5 @@ export default function makeSvgLayer(
2121
root.ungroupSingleChildDescendentGroups();
2222
svgImporter.scale_rootGroup(svgImporter.importer().scaleValue(), root);
2323

24-
return convertSketchToJson(root) as FileFormat.Group;
24+
return toSJSON(root) as FileFormat.Group;
2525
}

src/jsonUtils/sketchJson/convertJsonToSketch.ts renamed to src/jsonUtils/sketchJson/fromSJSON.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const SKETCH_HIGHEST_COMPATIBLE_VERSION = '95';
1010
/**
1111
* Takes a Sketch JSON tree and turns it into a native object. May throw on invalid data
1212
*/
13-
export default function convertJsonToSketch(
13+
export default function fromSJSON(
1414
jsonTree: FileFormat.AnyLayer | FileFormat.AnyObject,
1515
version = SKETCH_HIGHEST_COMPATIBLE_VERSION,
1616
): SketchLayer {

src/jsonUtils/sketchJson/convertSketchToJson.ts renamed to src/jsonUtils/sketchJson/toSJSON.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FileFormat1 as FileFormat } from '@sketch-hq/sketch-file-format-ts';
22
import { SketchLayer } from '../../types';
33

4-
export default function convertSketchToJson(
4+
export default function toSJSON(
55
sketchObject: SketchLayer,
66
): FileFormat.AnyObject | FileFormat.AnyLayer | null {
77
if (!sketchObject) {

src/render.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import convertJsonToSketch from './jsonUtils/sketchJson/convertJsonToSketch';
2+
import fromSJSON from './jsonUtils/sketchJson/fromSJSON';
33
import buildTree from './buildTree';
44
import flexToSketchJSON from './flexToSketchJSON';
55
import { resetLayer, resetDocument } from './resets';
@@ -42,7 +42,7 @@ const renderContents = async (
4242
bridge: PlatformBridge,
4343
): Promise<SketchLayer> => {
4444
const json = await flexToSketchJSON(tree, bridge);
45-
const layer = convertJsonToSketch(json, '119');
45+
const layer = fromSJSON(json, '119');
4646

4747
return renderLayers([layer], container);
4848
};

src/symbol.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as React from 'react';
22
import * as PropTypes from 'prop-types';
33
import { FileFormat1 as FileFormat } from '@sketch-hq/sketch-file-format-ts';
4-
import convertJsonToSketch from './jsonUtils/sketchJson/convertJsonToSketch';
5-
import convertSketchToJson from './jsonUtils/sketchJson/convertSketchToJson';
4+
import fromSJSON from './jsonUtils/sketchJson/fromSJSON';
5+
import toSJSON from './jsonUtils/sketchJson/toSJSON';
66
import StyleSheet from './stylesheet';
77
import { generateID } from './jsonUtils/models';
88
import ViewStylePropTypes from './components/ViewStylePropTypes';
@@ -49,7 +49,7 @@ const getExistingSymbols = (documentData: SketchDocumentData) => {
4949

5050
existingSymbols = msListToArray(symbolsPage.layers())
5151
.map(x => {
52-
const symbolJson = convertSketchToJson(x);
52+
const symbolJson = toSJSON(x);
5353
if (!symbolJson || symbolJson._class !== 'symbolMaster') {
5454
return undefined;
5555
}
@@ -95,7 +95,7 @@ export const injectSymbols = (
9595
symbolMaster.frame.x = left;
9696
left += symbolMaster.frame.width + 20;
9797

98-
const newLayer = convertJsonToSketch(symbolMaster, '119');
98+
const newLayer = fromSJSON(symbolMaster, '119');
9999
layers[symbolMaster.symbolID] = newLayer;
100100
});
101101

@@ -209,7 +209,7 @@ function tryGettingSymbolMasterInDocumentByName(
209209
return undefined;
210210
}
211211

212-
return convertSketchToJson(symbol) as FileFormat.SymbolMaster;
212+
return toSJSON(symbol) as FileFormat.SymbolMaster;
213213
}
214214

215215
function tryGettingSymbolMasterInDocumentById(
@@ -228,7 +228,7 @@ function tryGettingSymbolMasterInDocumentById(
228228
return undefined;
229229
}
230230

231-
return convertSketchToJson(symbol) as FileFormat.SymbolMaster;
231+
return toSJSON(symbol) as FileFormat.SymbolMaster;
232232
}
233233

234234
export const getSymbolMasterByName = (

src/utils/sharedTextStyles/index.sketch.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import invariant from 'invariant';
2-
import convertJsonToSketch from '../../jsonUtils/sketchJson/convertJsonToSketch';
3-
import convertSketchToJson from '../../jsonUtils/sketchJson/convertSketchToJson';
2+
import fromSJSON from '../../jsonUtils/sketchJson/fromSJSON';
3+
import toSJSON from '../../jsonUtils/sketchJson/toSJSON';
44
import { FileFormat1 as FileFormat } from '@sketch-hq/sketch-file-format-ts';
55
import { SketchDocument, TextStyle } from '../../types';
66
import { generateID } from '../../jsonUtils/models';
@@ -35,7 +35,7 @@ class TextStyles {
3535
const { _document } = this;
3636
invariant(_document, 'Please provide a sketch document reference');
3737

38-
const nativeStyle = convertJsonToSketch(style, '119');
38+
const nativeStyle = fromSJSON(style, '119');
3939

4040
const container = _document.documentData().layerTextStyles();
4141

@@ -86,7 +86,7 @@ class TextStyles {
8686
return undefined;
8787
}
8888

89-
const style = convertSketchToJson(foundStyle) as FileFormat.Style;
89+
const style = toSJSON(foundStyle) as FileFormat.Style;
9090

9191
return parseTextStyle(style);
9292
}

0 commit comments

Comments
 (0)