@dicebear/core 5.0.0-alpha.20 → 5.0.0-alpha.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/core.js CHANGED
@@ -2,7 +2,7 @@ import * as svgUtils from './utils/svg.js';
2
2
  import { merge as mergeOptions } from './utils/options.js';
3
3
  import { create as createPrng } from './utils/prng.js';
4
4
  import * as license from './utils/license.js';
5
- import * as convert from '@dicebear/converter';
5
+ import { toFormat } from '@dicebear/converter';
6
6
  export function createAvatar(style, options = {}) {
7
7
  var _a, _b;
8
8
  options = mergeOptions(style, options);
@@ -36,13 +36,14 @@ export function createAvatar(style, options = {}) {
36
36
  const metadata = license.xml(style);
37
37
  const exif = license.exif(style);
38
38
  const avatar = `<svg ${attributes}>${description}${metadata}${result.body}</svg>`;
39
- return Object.assign(avatar, {
40
- svg: () => convert.toFormat(avatar, 'svg'),
39
+ return {
40
+ toString: () => avatar,
41
+ ...toFormat(avatar, 'svg'),
41
42
  png: ({ includeExif = false }) => {
42
- return convert.toFormat(avatar, 'png', includeExif ? exif : undefined);
43
+ return toFormat(avatar, 'png', includeExif ? exif : undefined);
43
44
  },
44
45
  jpeg: ({ includeExif = false }) => {
45
- return convert.toFormat(avatar, 'jpeg', includeExif ? exif : undefined);
46
+ return toFormat(avatar, 'jpeg', includeExif ? exif : undefined);
46
47
  },
47
- });
48
+ };
48
49
  }
package/lib/types.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import type { JSONSchema7 } from 'json-schema';
2
- import type { BinaryResult } from '@dicebear/converter';
2
+ import type { Result as ConverterResult } from '@dicebear/converter';
3
3
  export interface ResultConvertOptions {
4
4
  includeExif?: boolean;
5
5
  }
6
- export declare type Result = string & {
7
- svg(): BinaryResult;
8
- png(options?: ResultConvertOptions): BinaryResult;
9
- jpeg(options?: ResultConvertOptions): BinaryResult;
10
- };
6
+ export interface Result extends ConverterResult {
7
+ png(options?: ResultConvertOptions): ConverterResult;
8
+ jpeg(options?: ResultConvertOptions): ConverterResult;
9
+ toString(): string;
10
+ }
11
11
  export interface Options {
12
12
  seed?: string;
13
13
  flip?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dicebear/core",
3
- "version": "5.0.0-alpha.20",
3
+ "version": "5.0.0-alpha.25",
4
4
  "description": "An avatar library for designers and developers.",
5
5
  "keywords": [
6
6
  "avatar",
@@ -31,7 +31,7 @@
31
31
  "test": "uvu tests"
32
32
  },
33
33
  "dependencies": {
34
- "@dicebear/converter": "^5.0.0-alpha.20",
34
+ "@dicebear/converter": "^5.0.0-alpha.25",
35
35
  "@types/json-schema": "^7.0.7"
36
36
  },
37
37
  "devDependencies": {
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "6b1c2bd64294365be21d0a133a362ede5ed62b5a"
49
+ "gitHead": "734200558f38d22fd831e84cfeff82d8caa242fe"
50
50
  }