本文整理汇总了TypeScript中@ember/utils.isEmpty函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isEmpty函数的具体用法?TypeScript isEmpty怎么用?TypeScript isEmpty使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isEmpty函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: isEmpty
(function() {
/** isEmpty */
// TODO fix upstream in @types/ember https://github.com/typed-ember/ember-cli-typescript/issues/255
// isEmpty(); // $ExpectType boolean
isEmpty(null); // $ExpectType boolean
isEmpty(undefined); // $ExpectType boolean
isEmpty(''); // $ExpectType boolean
isEmpty([]); // $ExpectType boolean
isEmpty({ size: 0 }); // $ExpectType boolean
isEmpty({}); // $ExpectType boolean
isEmpty('Adam Hawkins'); // $ExpectType boolean
isEmpty([0, 1, 2]); // $ExpectType boolean
isEmpty('\n\t'); // $ExpectType boolean
isEmpty(' '); // $ExpectType boolean
isEmpty({ size: 1 }); // $ExpectType boolean
isEmpty({ size: () => 0 }); // $ExpectType boolean
})();
示例2: isEmpty
(function() {
/** isEmpty */
isEmpty(); // $ExpectType boolean
isEmpty(null); // $ExpectType boolean
isEmpty(undefined); // $ExpectType boolean
isEmpty(''); // $ExpectType boolean
isEmpty([]); // $ExpectType boolean
isEmpty({ size: 0 }); // $ExpectType boolean
isEmpty({}); // $ExpectType boolean
isEmpty('Adam Hawkins'); // $ExpectType boolean
isEmpty([0, 1, 2]); // $ExpectType boolean
isEmpty('\n\t'); // $ExpectType boolean
isEmpty(' '); // $ExpectType boolean
isEmpty({ size: 1 }); // $ExpectType boolean
isEmpty({ size: () => 0 }); // $ExpectType boolean
})();
示例3: testIsEmpty
function testIsEmpty() {
utils.isEmpty(); // $ExpectType boolean
utils.isEmpty(''); // $ExpectType boolean
utils.isEmpty('', ''); // $ExpectError
}
示例4: _getFullHeadersHash
*/
_getFullHeadersHash(headers?: Headers): Headers {
const classHeaders = get(this, 'headers');
return assign({}, classHeaders!, headers!);
},
/**
* Created a normalized set of options from the per-request and
* service-level settings
*/
options(url: string, options: AJAXOptions = {}): AJAXOptions {
options = assign({}, options);
options.url = this._buildURL(url, options);
options.type = options.type || 'GET';
options.dataType = options.dataType || 'json';
options.contentType = isEmpty(options.contentType)
? get(this, 'contentType')
: options.contentType;
if (this._shouldSendHeaders(options)) {
options.headers = this._getFullHeadersHash(options.headers);
} else {
options.headers = options.headers || {};
}
return options;
},
/**
* Build a URL for a request
*