react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / js-yaml / lib / js-yaml / common.js
80698 views'use strict';123function isNothing(subject) {4return (typeof subject === 'undefined') || (null === subject);5}678function isObject(subject) {9return (typeof subject === 'object') && (null !== subject);10}111213function toArray(sequence) {14if (Array.isArray(sequence)) {15return sequence;16} else if (isNothing(sequence)) {17return [];18}19return [ sequence ];20}212223function extend(target, source) {24var index, length, key, sourceKeys;2526if (source) {27sourceKeys = Object.keys(source);2829for (index = 0, length = sourceKeys.length; index < length; index += 1) {30key = sourceKeys[index];31target[key] = source[key];32}33}3435return target;36}373839function repeat(string, count) {40var result = '', cycle;4142for (cycle = 0; cycle < count; cycle += 1) {43result += string;44}4546return result;47}484950function isNegativeZero(number) {51return (0 === number) && (Number.NEGATIVE_INFINITY === 1 / number);52}535455module.exports.isNothing = isNothing;56module.exports.isObject = isObject;57module.exports.toArray = toArray;58module.exports.repeat = repeat;59module.exports.isNegativeZero = isNegativeZero;60module.exports.extend = extend;616263