MCPcopy Index your code
hub / github.com/formatjs/formatjs / getHashDigest

Function getHashDigest

packages/ts-transformer/interpolate-name.ts:24–33  ·  view source on GitHub ↗
(
  content: string,
  hashType = 'md5',
  digestType: BinaryToTextEncoding = 'hex',
  length = 9999
)

Source from the content-addressed store, hash-verified

22export type NameFn = (resourcePath?: string, resourceQuery?: string) => string
23
24function getHashDigest(
25 content: string,
26 hashType = 'md5',
27 digestType: BinaryToTextEncoding = 'hex',
28 length = 9999
29) {
30 const hasher = createHash(hashType)
31 hasher.update(content)
32 return hasher.digest(digestType).slice(0, length)
33}
34
35export function interpolateName(
36 loaderContext: LoaderContext,

Callers 1

interpolateNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected