function wrap(innerFn, outerFn, self, tryLocsList) { // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; var generator = Object.create(protoGenerator.prototype); var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, // .throw, and .return methods. generator._invoke = makeInvokeMethod(innerFn, self, context); return generator; }
// Mock only the getLocaleSlug function from i18n-calypso, and use // original references for all the other functions function mockFunctions() { const original = jest.requireActual( 'i18n-calypso' ).default; return Object.assign( Object.create( Object.getPrototypeOf( original ) ), original, { getLocaleSlug: jest.fn( () => 'en' ), } ); }
export function initEvents(vm) { vm._events = Object.create(null) vm._hasHookEvent = false // init parent attached events const listeners = vm.$options._parentListeners if (listeners) { updateComponentListeners(vm, listeners) } }
test('prototype properties are not logged', async ({ is }) => { const stream = sink() const instance = pino(stream) instance.info(Object.create({ hello: 'world' })) const { hello } = await once(stream, 'data') is(hello, undefined) })
_clone() { const clone = Object.assign(Object.create(this), this); if (this.activities) clone.activities = this.activities.map(activity => activity._clone()); return clone; }
const createProvider = ({ provider, providerOptions }) => { try { const providerInstance = require(`strapi-provider-upload-${provider}`).init(providerOptions); return Object.assign(Object.create(baseProvider), providerInstance); } catch (err) { strapi.log.error(err); throw new Error( `The provider package isn't installed. Please run \`npm install strapi-provider-upload-${provider}\`` ); } }
/** * Create a cached version of a pure function. */ export function cached(fn) { const cache = Object.create(null) return (function cachedFn(str) { const hit = cache[str] return hit || (cache[str] = fn(str)) }) }
/** * Shallow-copies an object with its class/prototype intact. * @param {Object} obj Object to clone * @returns {Object} * @private */ static cloneObject(obj) { return Object.assign(Object.create(obj), obj); }
function nested(first, rest) { const o = Object.create(notPromise) o.first = first o.rest = rest.flat() return o }
function keyMirror(arr) { let tmp = Object.create(null); for (const value of arr) tmp[value] = value; return tmp; }
constructor({ ttl = DEFAULT_CACHE_TTL }) { this.ttl = ttl; this.cache = Object.create(null); }
function array(xs) { const o = Object.create(notPromise) o.array = xs return o }
const createProvider = ({ provider, providerOptions }) => { try { const providerInstance = require(`strapi-provider-upload-${provider}`).init(providerOptions); return Object.assign(Object.create(baseProvider), providerInstance); } catch (err) { strapi.log.error(err); throw new Error( `The provider package isn't installed. Please run \`npm install strapi-provider-upload-${provider}\`` ); } }
(function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "DATATYPE_UNDEFINED"] = 0; values[valuesById[1] = "DATATYPE_NULL"] = 1; values[valuesById[2] = "DATATYPE_JSON"] = 2; values[valuesById[3] = "DATATYPE_BUFFER"] = 3; return values; })()
constructor({ ttl = DEFAULT_CACHE_TTL }) { this.ttl = ttl; this.cache = Object.create(null); }