// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

import { isWindows } from "./_os.ts";
import { extname as posixExtname } from "./posix/extname.ts";
import { extname as windowsExtname } from "./windows/extname.ts";
/**
 * Return the extension of the `path` with leading period.
 * @param path with extension
 * @returns extension (ex. for `file.ts` returns `.ts`)
 */
export function extname(path: string): string {
  return isWindows ? windowsExtname(path) : posixExtname(path);
}

// denoCacheMetadata={"headers":{"cf-cache-status":"HIT","content-length":"547","cf-ray":"a223e6579a0f7db6-LAX","age":"2869020","server":"cloudflare","date":"Tue, 28 Jul 2026 12:31:15 GMT","alt-svc":"h3=\":443\"; ma=86400","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","etag":"\"548240d706ebfe2bf295acb6e71e7247\"","cross-origin-resource-policy":"cross-origin","vary":"Origin","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=owuqoC1ujZ95qf73CzrbT4fYm8oCSZNzlKkuaP4L9osPPomwibdMxyvbbq5c7Pnvz9NriQpSS3Y2ZgJTA5HcC1%2FTbmTQSR5Ykyi4%2BYYUk2%2B%2F7KtiWkd1YoY%3D\"}]}","access-control-expose-headers":"*","x-robots-tag":"noindex","access-control-allow-origin":"*","accept-ranges":"bytes","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","cache-control":"public, max-age=31536000, immutable","x-content-type-options":"nosniff","content-type":"text/typescript","x-jsr-backend":"modules","set-cookie":"__cf_bm=LFtkotFfVXKeWTEK9NwTYRjTOrI6lI4Jrk4aHXUjXBM-1785241875.1396453-1.0.1.1-JB6o1ANZzkBpiJgq2BtmtAZ8gRYq2oX9MVr_ADEcyDdmbT3fQcKY_imgXd2yInJB2D6g76TurP3THGluQxI9hlL_7aN50ZPjiJcSijRIGt8.4exfO7i.yWY2I8z5S7FU; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT"},"url":"https://jsr.io/@std/path/0.224.0/extname.ts","time":1785241875}