1"use strict";(self.webpackChunkgulpjs_github_io=self.webpackChunkgulpjs_github_io||[]).push([[96],{2347:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>p,frontMatter:()=>r,metadata:()=>l,toc:()=>c});var i=t(4848),s=t(8453);const r={id:"vinyl-iscustomprop",title:"Vinyl.isCustomProp()",hide_title:!0,sidebar_label:"Vinyl.isCustomProp()"},o="Vinyl.isCustomProp()",l={id:"api/vinyl-iscustomprop",title:"Vinyl.isCustomProp()",description:"Determines if a property is internally managed by Vinyl. Used by Vinyl when setting values inside the constructor or when copying properties in the clone() instance method.",source:"@site/docs/api/vinyl-iscustomprop.md",sourceDirName:"api",slug:"/api/vinyl-iscustomprop",permalink:"/docs/en/api/vinyl-iscustomprop",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"vinyl-iscustomprop",title:"Vinyl.isCustomProp()",hide_title:!0,sidebar_label:"Vinyl.isCustomProp()"},sidebar:"docs",previous:{title:"Vinyl.isVinyl()",permalink:"/docs/en/api/vinyl-isvinyl"},next:{title:"For Enterprise",permalink:"/docs/en/support/for-enterprise"}},d={},c=[{value:"Usage",id:"usage",level:2},{value:"Signature",id:"signature",level:2},{value:"Parameters",id:"parameters",level:3},{value:"Returns",id:"returns",level:3},{value:"Extending Vinyl",id:"extending-vinyl",level:2}];function a(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,s.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"vinyliscustomprop",children:"Vinyl.isCustomProp()"}),"\n",(0,i.jsxs)(n.p,{children:["Determines if a property is internally managed by Vinyl. Used by Vinyl when setting values inside the constructor or when copying properties in the ",(0,i.jsx)(n.code,{children:"clone()"})," instance method."]}),"\n",(0,i.jsxs)(n.p,{children:["This method is useful when extending the Vinyl class. Detailed in ",(0,i.jsx)(n.a,{href:"#extending-vinyl",children:"Extending Vinyl"})," below."]}),"\n",(0,i.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"const Vinyl = require('vinyl');\n\nVinyl.isCustomProp('sourceMap') === true;\nVinyl.isCustomProp('path') === false;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"Vinyl.isCustomProp(property)\n"})}),"\n",(0,i.jsx)(n.h3,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{style:{textAlign:"center"},children:"parameter"}),(0,i.jsx)(n.th,{style:{textAlign:"center"},children:"type"}),(0,i.jsx)(n.th,{children:"note"})]})}),(0,i.jsx)(n.tbody,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"property"}),(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(n.td,{children:"The property name to check."})]})})]}),"\n",(0,i.jsx)(n.h3,{id:"returns",children:"Returns"}),"\n",(0,i.jsx)(n.p,{children:"True if the property is not internally managed."}),"\n",(0,i.jsx)(n.h2,{id:"extending-vinyl",children:"Extending Vinyl"}),"\n",(0,i.jsxs)(n.p,{children:["When custom properties are managed internally, the static ",(0,i.jsx)(n.code,{children:"isCustomProp"})," method must be extended and return false when one of the custom properties is queried."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"const Vinyl = require('vinyl');\n\nconst builtInProps = ['foo', '_foo'];\n\nclass SuperFile extends Vinyl {\n constructor(options) {\n super(options);\n this._foo = 'example internal read-only value';\n }\n\n get foo() {\n return this._foo;\n }\n\n static isCustomProp(name) {\n return super.isCustomProp(name) && builtInProps.indexOf(name) === -1;\n }\n}\n"})}),"\n",(0,i.jsxs)(n.p,{children:["In the example above, ",(0,i.jsx)(n.code,{children:"foo"})," and ",(0,i.jsx)(n.code,{children:"_foo"})," will not be assigned to the new object when cloning or passed in ",(0,i.jsx)(n.code,{children:"options"})," to ",(0,i.jsx)(n.code,{children:"new SuperFile(options)"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["If your custom properties or logic require special handling during cloning, override the ",(0,i.jsx)(n.code,{children:"clone"})," method while extending Vinyl."]})]})}function p(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>l});var i=t(6540);const s={},r=i.createContext(s);function o(e){const n=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),i.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.