function toType( obj ) { if ( obj == null ) { return obj + ""; } // Support: Android <=2.3 only (functionish RegExp) return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call( obj ) ] || "object" : typeof obj; }
function getNormalizedKey(key) { const normalizedKey = getNormalizedKeyAttributeValue(key); if (key !== normalizedKey) { this.debugSection('Input', `Mapping key '${key}' to '${normalizedKey}'`); } // Use key definition to ensure correct key is displayed when Shift modifier is active if (Object.prototype.hasOwnProperty.call(keyDefinitionMap, normalizedKey)) { return keyDefinitionMap[normalizedKey]; } return normalizedKey; }
const getDateObject = (dateString) => { const date = new Date(dateString) // Thanks to https://stackoverflow.com/questions/1353684/detecting-an-invalid-date-date-instance-in-javascript if (Object.prototype.toString.call(date) === '[object Date]' && isNaN(date.getTime())) { throw new Error(`invalid date string ${dateString}`) } return date }
// fallback for not array-like strings $export($export.P + $export.F * (_dereq_(47) != Object || !_dereq_(105)(arrayJoin)), 'Array', { join: function join(separator) { return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator); } });
function generateBinArgs( name ) { if ( Object.prototype.hasOwnProperty.call( config.codemodArgs, name ) ) { // Is the codemod defined in the codemodArgs object? return config.codemodArgs[ name ]; } if ( getLocalCodemodFileNames().includes( name ) ) { return [ `--transform=${ transformsDir }/${ name }.js` ]; } throw new Error( `"${ name }" is an unrecognized codemod.` ); }
var $propertyIsEnumerable = function propertyIsEnumerable(key) { var E = isEnum.call(this, key = toPrimitive(key, true)); if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false; return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; }
// Mimic commander syntax errors (with offsets) for consistency /* eslint-disable no-console */ const exitWithError = function () { const args = Array.prototype.slice.call(arguments); console.error(); console.error(...[" "].concat(args)); console.error(); process.exit(1); // eslint-disable-line no-process-exit }
Object.keys(options).forEach(key => { if (!Object.prototype.hasOwnProperty.call(this, key)) { this[key] = options[key]; } });
walkIdentifier(node, context) { if ({}.hasOwnProperty.call(context, node.name)) { return context[node.name]; } return this.failResult; }
/** * Returns `true` if `v` is a DOM File instance, `false` otherwise. * * @param {any} v - instance to analyze * @returns {boolean} `true` if `v` is a DOM File instance */ function isFile( v ) { return v && Object.prototype.toString.call( v ) === '[object File]'; }
walkThis(node, context) { if ({}.hasOwnProperty.call(context, 'this')) { // eslint-disable-next-line return context["this"]; } return this.failResult; }
export function dump(obj) { let out = ''; for (const key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { out += `${key}: ${obj[key]}\n`; } } return out; }
function wash (opts) { const copy = {} for (const k in opts) { if (!hasOwnProperty.call(opts, k)) continue if (opts[k] != null) copy[k] = opts[k] } return copy }
/** * Strict object type check. Only returns true * for plain JavaScript objects. */ export function isPlainObject(obj) { return _toString.call(obj) === '[object Object]' }
const getDateObject = (dateString) => { const date = new Date(dateString) // Thanks to https://stackoverflow.com/questions/1353684/detecting-an-invalid-date-date-instance-in-javascript if (Object.prototype.toString.call(date) === '[object Date]' && isNaN(date.getTime())) { throw new Error(`invalid date string ${dateString}`) } return date }