PageSourceSearch

https://headlamp.dev/assets/js/77b107ca.17e154d3.js

js headlamp.dev collected 2026-10-02 06:05:25 UTC 4,302 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkheadlamp_website=self.webpackChunkheadlamp_website||[]).push([[22029],{14906:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>d,default:()=>u,frontMatter:()=>r,metadata:()=>c,toc:()=>o});var t=s(74848),i=s(28453);const r={},d="Function: divideK8sResources()",c={id:"latest/development/api/lib/util/namespaces/units/functions/divideK8sResources",title:"Function: divideK8sResources()",description:"Defined in105",source:"@site/docs/latest/development/api/lib/util/namespaces/units/functions/divideK8sResources.md",sourceDirName:"latest/development/api/lib/util/namespaces/units/functions",slug:"/latest/development/api/lib/util/namespaces/units/functions/divideK8sResources",permalink:"/docs/latest/development/api/lib/util/namespaces/units/functions/divideK8sResources",draft:!1,unlisted:!1,editUrl:"https://github.com/kubernetes-sigs/headlamp/edit/main/docs/development/api/lib/util/namespaces/units/functions/divideK8sResources.md",tags:[],version:"current",frontMatter:{},sidebar:"mainSidebar",previous:{title:"units",permalink:"/docs/latest/development/api/lib/util/namespaces/units/API"},next:{title:"Function: parseCpu()",permalink:"/docs/latest/development/api/lib/util/namespaces/units/functions/parseCpu"}},l={},o=[{value:"Parameters",id:"parameters",level:2},{value:"Returns",id:"returns",level:2}];function a(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"function-dividek8sresources",children:"Function: divideK8sResources()"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:'function divideK8sResources(\n   a: string, \n   b: string, \n   resourceType?: "cpu" | "memory"): number;\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Defined in: ",(0,t.jsx)(n.a,{href:"https://github.com/kubernetes-sigs/headlamp/blob/9cb8e9a311f736f645f4a06f251f59bddca3cf60/frontend/src/lib/units.ts#L105",children:"lib/units.ts:105"})]}),"\n",(0,t.jsx)(n.p,{children:"Divides two Kubernetes resource quantities.\nUseful for computing resource field references with divisors."}),"\n",(0,t.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,t.jsxs)(n.table,{children:[(0,t.jsx)(n.thead,{children:(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.th,{children:"Parameter"}),(0,t.jsx)(n.th,{children:"Type"}),(0,t.jsx)(n.th,{children:"Default value"}),(0,t.jsx)(n.th,{children:"Description"})]})}),(0,t.jsxs)(n.tbody,{children:[(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"a"})}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"string"})}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"undefined"})}),(0,t.jsx)(n.td,{children:'The dividend resource string (e.g., "1Gi", "500m")'})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"b"})}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"string"})}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"undefined"})}),(0,t.jsx)(n.td,{children:'The divisor resource string (e.g., "1Mi", "1")'})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"resourceType"})}),(0,t.jsxs)(n.td,{children:[(0,t.jsx)(n.code,{children:'"cpu"'})," | ",(0,t.jsx)(n.code,{children:'"memory"'})]}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.code,{children:"'memory'"})}),(0,t.jsx)(n.td,{children:"The type of resource ('cpu' or 'memory'). Defaults to 'memory'."})]})]})]}),"\n",(0,t.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.code,{children:"number"})}),"\n",(0,t.jsx)(n.p,{children:"The result of dividing a by b"})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(a,{...e})}):a(e)}},28453:(e,n,s)=>{s.d(n,{R:()=>d,x:()=>c});var t=s(96540);const i={},r=t.createContext(i);function d(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:d(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.