(entity: string | Buffer | Stats, options?: { weak: boolean })
| 25 | } |
| 26 | |
| 27 | export const eTag = (entity: string | Buffer | Stats, options?: { weak: boolean }) => { |
| 28 | if (entity == null) { |
| 29 | throw new TypeError('argument entity is required') |
| 30 | } |
| 31 | |
| 32 | const weak = options?.weak || entity instanceof Stats |
| 33 | |
| 34 | // generate entity tag |
| 35 | |
| 36 | const tag = entity instanceof Stats ? statTag(entity) : entityTag(entity) |
| 37 | |
| 38 | return weak ? 'W/' + tag : tag |
| 39 | } |
no test coverage detected