<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Prototypes——模具行业从业者必备知识手册]]></title><description><![CDATA[<p dir="auto">&lt;h2&gt;Prototypes&lt;/h2&gt;</p>
<p dir="auto">&lt;p&gt;The functions in this folder are to be use for keeping cached references to the built-in prototypes, so that people can't inadvertently break the library by making mistakes in userland.&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;See <a href="https://github.com/sinonjs/sinon/pull/1523" rel="nofollow ugc">https://github.com/sinonjs/sinon/pull/1523</a>&lt;/p&gt;</p>
<p dir="auto">&lt;h3&gt;Without cached references&lt;/h3&gt;</p>
<p dir="auto">&lt;pre&gt;&lt;code&gt;<br />
// in userland, the library user needs to replace the filter method on<br />
// Array.prototype<br />
var array = [1, 2, 3];<br />
sinon.replace(array, "filter", sinon.fake.returns(2));</p>
<p dir="auto">// in a sinon module, the library author needs to use the filter method<br />
var someArray = ["a", "b", 42, "c"];<br />
var answer = filter(someArray, function (v) {<br />
return v === 42;<br />
});</p>
<p dir="auto">console.log(answer);<br />
// =&gt; 2<br />
&lt;/code&gt;&lt;/pre&gt;</p>
<p dir="auto">&lt;h3&gt;With cached references&lt;/h3&gt;</p>
<p dir="auto">&lt;pre&gt;&lt;code&gt;<br />
// in userland, the library user needs to replace the filter method on<br />
// Array.prototype<br />
var array = [1, 2, 3];<br />
sinon.replace(array, "filter", sinon.fake.returns(2));</p>
<p dir="auto">// in a sinon module, the library author needs to use the filter method<br />
// get a reference to the original Array.prototype.filter<br />
var filter = require("@sinonjs/commons").prototypes.array.filter;<br />
var someArray = ["a", "b", 42, "c"];<br />
var answer = filter(someArray, function (v) {<br />
return v === 42;<br />
});</p>
<p dir="auto">console.log(answer);<br />
// =&gt; 42<br />
&lt;/code&gt;&lt;/pre&gt;</p>
<p dir="auto">&lt;hr&gt;</p>
<p dir="auto">&lt;p&gt;本文由模极社发布&lt;/p&gt;</p>
<p dir="auto">&lt;h4&gt;<img src="https://forum.mj7.cn/assets/plugins/nodebb-plugin-emoji/emoji/android/1f4cb.png?v=k0o2a4s5i30" class="not-responsive emoji emoji-android emoji--clipboard" title=":clipboard:" alt="📋" /> 内容概览&lt;/h4&gt;</p>
<p dir="auto">&lt;table&gt;<br />
&lt;tr&gt;&lt;td&gt;分类&lt;/td&gt;&lt;td&gt;要点&lt;/td&gt;&lt;td&gt;建议/说明&lt;/td&gt;&lt;/tr&gt;<br />
&lt;tr&gt;&lt;td&gt;核心概念&lt;/td&gt;&lt;td&gt;Prototypes&lt;/td&gt;&lt;td&gt;详见正文&lt;/td&gt;&lt;/tr&gt;<br />
&lt;tr&gt;&lt;td&gt;操作步骤&lt;/td&gt;&lt;td&gt;Prototypes&lt;/td&gt;&lt;td&gt;详见正文&lt;/td&gt;&lt;/tr&gt;<br />
&lt;tr&gt;&lt;td&gt;注意事项&lt;/td&gt;&lt;td&gt;Prototypes&lt;/td&gt;&lt;td&gt;详见正文&lt;/td&gt;&lt;/tr&gt;<br />
&lt;tr&gt;&lt;td&gt;适用场景&lt;/td&gt;&lt;td&gt;Prototypes&lt;/td&gt;&lt;td&gt;详见正文&lt;/td&gt;&lt;/tr&gt;<br />
&lt;tr&gt;&lt;td&gt;常见问题&lt;/td&gt;&lt;td&gt;Prototypes&lt;/td&gt;&lt;td&gt;详见正文&lt;/td&gt;&lt;/tr&gt;<br />
&lt;/table&gt;</p>
<p dir="auto">&lt;hr&gt;<br />
&lt;h4&gt;<img src="https://forum.mj7.cn/assets/plugins/nodebb-plugin-emoji/emoji/android/1f517.png?v=k0o2a4s5i30" class="not-responsive emoji emoji-android emoji--link" title=":link:" alt="🔗" /> 你可能还感兴趣&lt;/h4&gt;<br />
&lt;ul&gt;<br />
&lt;li&gt;&lt;a href="/t/3478/3478"&gt;VDMA 德国机械制造商联合会工模具分会&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="/t/4375/4375"&gt;jest-docblock&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="/t/4507/4507"&gt;@vue/compiler-vapor&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;</p>
<p dir="auto">&lt;hr&gt;<br />
&lt;p&gt;&lt;strong&gt;相关推荐：&lt;/strong&gt;&lt;/p&gt;<br />
&lt;ul&gt;<br />
&lt;li&gt;&lt;a href="<a href="https://www.mj7.cn/t/4836-4836" rel="nofollow ugc">https://www.mj7.cn/t/4836-4836</a>"&gt;北京模具产业 — 科技研发驱动型模具基地&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="<a href="https://www.mj7.cn/t/4835-4835" rel="nofollow ugc">https://www.mj7.cn/t/4835-4835</a>"&gt;上海模具产业 — 高端精密模具研发中心&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="<a href="https://www.mj7.cn/t/4834-4834" rel="nofollow ugc">https://www.mj7.cn/t/4834-4834</a>"&gt;产业集群与模具产业发展的关系&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;</p>
<p dir="auto">&lt;hr&gt;<br />
&lt;p&gt;这个参数你们一般设多少？评论区说说。&lt;/p&gt;</p>
]]></description><link>https://forum.mj7.cn/topic/7257/prototypes-模具行业从业者必备知识手册</link><generator>RSS for Node</generator><lastBuildDate>Fri, 02 Oct 2026 07:36:29 GMT</lastBuildDate><atom:link href="https://forum.mj7.cn/topic/7257.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 19 Apr 2026 22:21:21 GMT</pubDate><ttl>60</ttl></channel></rss>