Skip to content

Releases: zgid123/string-interpolation-js

v1.0.8

29 Apr 17:13
Compare
Choose a tag to compare

Release v1.0.8

Changelogs

allow custom type for TypeScript usage

before

interface IUserProps {
  email: string;
  displayName: string;
}

const template = '{{ user.displayName }} just joined the chat.';

interpole(
  template,
  {
    user: {
      email: 'test',
      displayName: 'test',
    },
  },
  {
    exactMatch: true,
    specElement: '_',
    pattern: '{{ _ }}',
  },
);

This will raise error for typing

after

interface IUserProps {
  email: string;
  displayName: string;
}

const template = '{{ user.displayName }} just joined the chat.';

interpole<{ user: IUserProps }>(
  template,
  {
    user: {
      email: 'test',
      displayName: 'test',
    },
  },
  {
    exactMatch: true,
    specElement: '_',
    pattern: '{{ _ }}',
  },
);

or

interface IUserProps {
  email: string;
  displayName: string;
}

const template = '{{ user.displayName }} just joined the chat.';

const user: IUserProps = {
  email: 'test',
  displayName: 'test',
};

interpole(
  template,
  {
    user,
  },
  {
    exactMatch: true,
    specElement: '_',
    pattern: '{{ _ }}',
  },
);

v1.0.7

06 Apr 21:58
Compare
Choose a tag to compare

Release v1.0.7

Changelogs

  • use rollup to build to cjs and mjs
  • use vitest instead of jest