PageSourceSearch

https://turfjs.org/assets/js/d3d3f500.f23ee5b3.js

js turfjs.org collected 2026-09-24 09:17:41 UTC 7,343 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkturf_www||=[]).push([[12948],{19828(e,n,t){t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>h,default:()=>m,frontMatter:()=>d,metadata:()=>o,toc:()=>u});const o=JSON.parse('{"id":"api/clone","title":"clone","description":"{() => }","source":"@site/versioned_docs/version-7.1.0/api/clone.mdx","sourceDirName":"api","slug":"/api/clone","permalink":"/docs/7.1.0/api/clone","draft":false,"unlisted":false,"editUrl":"https://github.com/Turfjs/turf-www/tree/master/versioned_docs/version-7.1.0/api/clone.mdx","tags":[],"version":"7.1.0","frontMatter":{"title":"clone"},"sidebar":"apiSidebar","previous":{"title":"circle","permalink":"/docs/7.1.0/api/circle"},"next":{"title":"concave","permalink":"/docs/7.1.0/api/concave"}}');var r=t(86070),i=t(67028),l=t(64776),s={};t.r(s),t.d(s,{along:()=>l.Qwm,angle:()=>l.g7h,applyFilter:()=>l.$hf,area:()=>l.Wcw,areaFactors:()=>l.i26,azimuthToBearing:()=>l.Oe8,bbox:()=>l.Qk1,bboxClip:()=>l.ywB,bboxPolygon:()=>l.kJI,bearing:()=>l.dcc,bearingToAzimuth:()=>l.u8E,bezierSpline:()=>l.vKl,booleanClockwise:()=>l.D2R,booleanConcave:()=>l.U7O,booleanContains:()=>l.yxm,booleanCrosses:()=>l.hkq,booleanDisjoint:()=>l.t5S,booleanEqual:()=>l.x0k,booleanIntersects:()=>l.lgr,booleanOverlap:()=>l.cYD,booleanParallel:()=>l.Y5$,booleanPointInPolygon:()=>l.mFO,booleanPointOnLine:()=>l.O84,booleanTouches:()=>l.UsQ,booleanValid:()=>l.hxF,booleanWithin:()=>l.Cei,buffer:()=>l.ra8,center:()=>l.gXo,centerMean:()=>l.rb,centerMedian:()=>l.eZr,centerOfMass:()=>l.NAY,centroid:()=>l.vh2,circle:()=>l.n1W,cleanCoords:()=>l.ayX,clone:()=>l.o8B,cloneProperties:()=>l.Rdw,clusterEach:()=>l.UZ0,clusterReduce:()=>l.HYf,clusters:()=>l.qf7,clustersDbscan:()=>l.Zqw,clustersKmeans:()=>l.pPd,collect:()=>l.Fod,collectionOf:()=>l.iww,combine:()=>l.kg7,concave:()=>l.Ms8,containsNumber:()=>l.lOq,convertArea:()=>l.vnt,convertLength:()=>l.I3T,convex:()=>l.y5H,coordAll:()=>l.D3w,coordEach:()=>l.Fh1,coordReduce:()=>l.k7X,createBins:()=>l.f8u,degreesToRadians:()=>l.tRv,destination:()=>l.j_,difference:()=>l.iv2,directionalMean:()=>l.eFb,dissolve:()=>l.a1F,distance:()=>l.IoC,distanceWeight:()=>l.mJ,earthRadius:()=>l.zXD,ellipse:()=>l.pw2,envelope:()=>l.REH,explode:()=>l.Gdr,factors:()=>l.PgN,feature:()=>l.N4z,featureCollection:()=>l.Lrk,featureEach:()=>l.usj,featureOf:()=>l.mo4,featureReduce:()=>l.n4j,filterProperties:()=>l.qV7,findPoint:()=>l.Yd2,findSegment:()=>l.ptW,flatten:()=>l.Bqz,flattenEach:()=>l.iwz,flattenReduce:()=>l.VJK,flip:()=>l.UUz,geojsonRbush:()=>l.sZS,geojsonType:()=>l.e8v,geomEach:()=>l.kX6,geomReduce:()=>l.jEc,geometry:()=>l.lCx,geometryCollection:()=>l.zbs,getCluster:()=>l.dB3,getCoord:()=>l.uGX,getCoords:()=>l.$Rn,getGeom:()=>l.bgk,getType:()=>l.Pwh,greatCircle:()=>l.Glg,helpers:()=>l._$r,hexGrid:()=>l.O9B,interpolate:()=>l.GWP,intersect:()=>l.y$5,invariant:()=>l.V1S,isNumber:()=>l.EtT,isObject:()=>l.Gvm,isobands:()=>l.Mii,isolines:()=>l.LNI,kinks:()=>l.nUT,length:()=>l.Bw9,lengthToDegrees:()=>l.vlv,lengthToRadians:()=>l.GfV,lineArc:()=>l.FsR,lineChunk:()=>l.W26,lineEach:()=>l.Iet,lineIntersect:()=>l.kVe,lineOffset:()=>l.uO7,lineOverlap:()=>l._Jg,lineReduce:()=>l.t0h,lineSegment:()=>l.wdR,lineSlice:()=>l.ne9,lineSliceAlong:()=>l.qMT,lineSplit:()=>l.JQ7,lineString:()=>l.wiw,lineStrings:()=>l.Nls,lineToPolygon:()=>l.gP4,mask:()=>l.dKf,meta:()=>l.mIj,midpoint:()=>l.PVF,moranIndex:()=>l.KFB,multiLineString:()=>l.NUZ,multiPoint:()=>l.kBJ,multiPolygon:()=>l.g52,nearestNeighborAnalysis:()=>l.rBB,nearestPoint:()=>l.xCI,nearestPointOnLine:()=>l.W1F,nearestPointToLine:()=>l.K9N,planepoint:()=>l.xYr,point:()=>l.zx7,pointGrid:()=>l.hq2,pointOnFeature:()=>l.QwJ,pointToLineDistance:()=>l.d4V,pointToPolygonDistance:()=>l.fJX,points:()=>l.WRA,pointsWithinPolygon:()=>l.nj9,polygon:()=>l.n1,polygonSmooth:()=>l.bmV,polygonTangents:()=>l.v4M,polygonToLine:()=>l.CNZ,polygonize:()=>l.Tz9,polygons:()=>l.qFD,projection:()=>l.Qju,propEach:()=>l.nPV,propReduce:()=>l.qBo,propertiesContainsFilter:()=>l.NLl,quadratAnalysis:()=>l.txz,radiansToDegrees:()=>l.nv6,radiansToLength:()=>l.cJD,random:()=>l.yTv,randomLineString:()=>l.lWQ,randomPoint:()=>l._eC,randomPolygon:()=>l.myJ,randomPosition:()=>l.Dxs,rectangleGrid:()=>l.K1I,rewind:()=>l.KrA,rhumbBearing:()=>
1l.Fc$,rhumbDestination:()=>l.rmV,rhumbDistance:()=>l.EUY,round:()=>l.LIG,sample:()=>l.XM1,sector:()=>l.rkH,segmentEach:()=>l.RPu,segmentReduce:()=>l.OQs,shortestPath:()=>l._6q,simplify:()=>l.CRN,square:()=>l.EwI,squareGrid:()=>l.cS4,standardDeviationalEllipse:()=>l.C0c,tag:()=>l.TcI,tesselate:()=>l.nYW,tin:()=>l.ucs,toMercator:()=>l.FU4,toWgs84:()=>l.zY8,transformRotate:()=>l.qS_,transformScale:()=>l.nIv,transformTranslate:()=>l.tLh,triangleGrid:()=>l.Vwd,truncate:()=>l.xvE,union:()=>l.KCZ,unkinkPolygon:()=>l.BoU,validateBBox:()=>l.O6s,validateId:()=>l.GZo,voronoi:()=>l.B8d});t(36796);var a=t(35876),c=t(25333);const d={title:"clone"},h=void 0,p={},u=[{value:"Description",id:"description",level:3},{value:"Parameters",id:"parameters",level:3},{value:"Returns",id:"returns",level:3},{value:"Examples",id:"examples",level:3},{value:"Installation",id:"installation",level:3}];function g(e){const n={a:"a",code:"code",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.A,{children:()=>(0,r.jsx)(a.A,{turf:s})}),"\n",(0,r.jsx)(n.h3,{id:"description",children:"Description"}),"\n",(0,r.jsx)(n.p,{children:"Returns a cloned copy of the passed GeoJSON Object, including possible 'Foreign Members'.\n~3-5x faster than the common JSON.parse + JSON.stringify combo method."}),"\n",(0,r.jsx)(n.h3,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(n.table,{children:[(0,r.jsx)(n.thead,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.th,{children:"Name"}),(0,r.jsx)(n.th,{children:"Type"}),(0,r.jsx)(n.th,{children:"Description"})]})}),(0,r.jsx)(n.tbody,{children:(0,r.jsxs)(n.tr,{children:[(0,r.jsx)(n.td,{children:"geojson"}),(0,r.jsx)(n.td,{children:(0,r.jsx)(n.strong,{children:(0,r.jsx)(n.a,{href:"https://tools.ietf.org/html/rfc7946#section-3",children:"GeoJSON"})})}),(0,r.jsx)(n.td,{children:"GeoJSON Object"})]})})]}),"\n",(0,r.jsx)(n.h3,{id:"returns",children:"Returns"}),"\n",(0,r.jsx)("ul",{children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:(0,r.jsx)(n.a,{href:"https://tools.ietf.org/html/rfc7946#section-3",children:"GeoJSON"})})," cloned GeoJSON Object"]})}),"\n",(0,r.jsx)(n.h3,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-javascript",children:'var line = turf.lineString(\n  [\n    [-74, 40],\n    [-78, 42],\n    [-82, 35],\n  ],\n  { color: "red" },\n);\n\nvar lineCloned = turf.clone(line);\n'})}),"\n",(0,r.jsx)(n.h3,{id:"installation",children:"Installation"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-javascript",children:'$ npm install @turf/clone\n\nimport { clone } from "@turf/clone";\nconst result = clone(...);\n'})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-javascript",children:'$ npm install @turf/turf\n\nimport * as turf from "@turf/turf";\nconst result = turf.clone(...);\n'})})]})}function m(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(g,{...e})}):g(e)}}}]);

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.