ember-source
Version:
A JavaScript framework for creating ambitious web applications
76 lines (66 loc) • 2.46 kB
JavaScript
export { m as dictionary } from '../../../shared-chunks/dictionary-gc5gpyOG.js';
export { g as getDebugName } from '../../../shared-chunks/get-debug-name-BDxIL2Y1.js';
export { G as GUID_KEY, R as ROOT, c as checkHasSuper, a as generateGuid, g as guidFor, b as intern, i as isObject, o as observerListenerMetaFor, d as setListeners, s as setObservers, u as uuid, w as wrap } from '../../../shared-chunks/super-Cm_a_cLQ.js';
export { l as lookupDescriptor } from '../../../shared-chunks/lookup-descriptor-CwcVgaLv.js';
export { g as getName, s as setName } from '../../../shared-chunks/name-C68GLLO3.js';
export { i as isProxy, s as setProxy } from '../../../shared-chunks/is_proxy-Cr1qlMv_.js';
export { C as Cache } from '../../../shared-chunks/cache-qDyqAcpg.js';
import '../environment/index.js';
/**
Checks to see if the `methodName` exists on the `obj`.
```javascript
let foo = { bar: function() { return 'bar'; }, baz: null };
Ember.canInvoke(foo, 'bar'); // true
Ember.canInvoke(foo, 'baz'); // false
Ember.canInvoke(foo, 'bat'); // false
```
@method canInvoke
@for Ember
@param {Object} obj The object to check for the method
@param {String} methodName The method name to check for
@return {Boolean}
@private
*/
function canInvoke(obj, methodName) {
return obj != null && typeof obj[methodName] === 'function';
}
/**
@module @ember/utils
*/
const objectToString = Object.prototype.toString;
function isNone(obj) {
return obj === null || obj === undefined;
}
/*
A `toString` util function that supports objects without a `toString`
method, e.g. an object created with `Object.create(null)`.
*/
function toString(obj) {
if (typeof obj === 'string') {
return obj;
}
if (null === obj) return 'null';
if (undefined === obj) return 'undefined';
if (Array.isArray(obj)) {
// Reimplement Array.prototype.join according to spec (22.1.3.13)
// Changing ToString(element) with this safe version of ToString.
let r = '';
for (let k = 0; k < obj.length; k++) {
if (k > 0) {
r += ',';
}
if (!isNone(obj[k])) {
r += toString(obj[k]);
}
}
return r;
}
if (typeof obj.toString === 'function') {
return obj.toString();
}
return objectToString.call(obj);
}
let setupMandatorySetter;
let teardownMandatorySetter;
let setWithMandatorySetter;
export { canInvoke, setWithMandatorySetter, setupMandatorySetter, teardownMandatorySetter, toString };