Skip to content

Commit

Permalink
refactor!: remove named export 'parse()'
Browse files Browse the repository at this point in the history
This is an internal method and never meant to be called by users.
Furthermore, the default export `Psd` class also has a static `parse()`
method, which could be easily confused with the method.
Thus, we're removing it from the list of exports.

Also edit Node.js example script, which was previously using this
`parse()` to print information to the console (indicating successful
parse). Instead, stringify and print the `Psd` object directly.
  • Loading branch information
Yehyoung Kang authored and pastelmind committed Jun 17, 2022
1 parent 564b5a5 commit 86af282
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/example-node/script.js
Expand Up @@ -6,12 +6,12 @@ import * as fs from "fs";
import * as path from "path";
import {fileURLToPath} from "url";

import * as Psd from "@webtoon/psd";
import Psd from "@webtoon/psd";

const __dirname = path.dirname(fileURLToPath(import.meta.url));

const file_path = path.resolve(__dirname, "./example.psd");
const psd_file = fs.readFileSync(file_path);

const psd = Psd.parse(psd_file.buffer);
console.log(psd.fileHeader);
console.log(psd);
1 change: 0 additions & 1 deletion packages/psd/src/index.ts
Expand Up @@ -7,6 +7,5 @@ import {Psd} from "./classes";
export type {Group, Layer, Node, NodeChild, NodeParent, Slice} from "./classes";
export {ColorMode, Depth, GuideDirection, SliceOrigin} from "./interfaces";
export type {Guide} from "./interfaces";
export {parse} from "./methods";

export default Psd;

0 comments on commit 86af282

Please sign in to comment.