UNPKG

2.01 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <title>JSDoc: Source: jsframework/core/utils/utils.js</title>
6
7 <script src="scripts/prettify/prettify.js"> </script>
8 <script src="scripts/prettify/lang-css.js"> </script>
9 <!--[if lt IE 9]>
10 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11 <![endif]-->
12 <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13 <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14</head>
15
16<body>
17
18<div id="main">
19
20 <h1 class="page-title">Source: jsframework/core/utils/utils.js</h1>
21
22
23
24
25
26
27 <section>
28 <article>
29 <pre class="prettyprint source linenums"><code>/**
30 * Created by zhangmike on 16/10/19.
31 */
32function isType(type){
33 return function(obj){
34 return Object.prototype.toString.call(obj) === '[object '+type+']';
35 };
36}
37export default {
38 isFunction(name) {
39 return isType('Function')(name);
40 },
41 isObject(name) {
42 return isType('Object')(name);
43 },
44 has(obj, key) {
45 return obj != null &amp;&amp; Object.prototype.hasOwnProperty.call(obj, key);
46 },
47 create(proto, props) {
48 if (this.isObject(props)) {
49 Object.keys(props).forEach(key => {
50 proto[key] = props[key];
51 });
52 }
53 return proto;
54 }
55};
56</code></pre>
57 </article>
58 </section>
59
60
61
62
63</div>
64
65<nav>
66 <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="global.html#GMP">GMP</a></li><li><a href="module.html#.exports">exports</a></li></ul><h3>Global</h3><ul><li><a href="global.html#isType">isType</a></li><li><a href="global.html#uid">uid</a></li></ul>
67</nav>
68
69<br class="clear">
70
71<footer>
72 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.2</a> on Mon Oct 24 2016 18:10:18 GMT+0800 (CST)
73</footer>
74
75<script> prettyPrint(); </script>
76<script src="scripts/linenumber.js"> </script>
77</body>
78</html>