const cloneItemContent = (li: Element): Element[] => { const children = Traverse.children(li); const content = hasLastChildList(li) ? children.slice(0, -1) : children; return Arr.map(content, Replication.deep); }
const getFragmentAssetUris = (refs, assetSize) => { const scriptUris = []; const styleUris = []; for (const ref of refs) { if (ref.rel === 'fragment-script') { scriptUris.push(ref.uri); } else if (ref.rel === 'stylesheet') { styleUris.push(ref.uri); } } return [scriptUris.slice(0, assetSize), styleUris.slice(0, assetSize)]; }
// (publicKey -> cert) cache function verifyPublicKeyUrl(publicKeyUrl) { const parsedUrl = url.parse(publicKeyUrl); if (parsedUrl.protocol !== 'https:') { return false; } const hostnameParts = parsedUrl.hostname.split('.'); const length = hostnameParts.length; const domainParts = hostnameParts.slice(length - 2, length); const domain = domainParts.join('.'); return domain === 'apple.com'; }
threadsWithMessageCounts .filter(t => t.messageCount > 0) .sort((a, b) => { const bc = parseInt(b.messageCount, 10); const ac = parseInt(a.messageCount, 10); return bc <= ac ? -1 : 1; }) .slice(0, 10) .map(t => t.id)
const writeShallow = (scope: Document, cast: Segment[], entry: Entry): Segment[] => { const newCast = cast.slice(0, entry.depth); Arr.last(newCast).each((segment) => { const item = createItem(scope, entry.itemAttributes, entry.content); appendItem(segment, item); normalizeSegment(segment, entry); }); return newCast; }
[ 'single', 'plural', 'options' ].slice( 0, args.length ).forEach( function ( field, i ) { if ( 'StringLiteral' === args[ i ].type ) { finalProps[ field ] = makeDoubleQuoted( args[ i ].extra.raw ); } else if ( 'BinaryExpression' === args[ i ].type ) { finalProps[ field ] = encapsulateString( concatenateBinaryExpression( args[ i ] ) ); } else if ( 'ObjectExpression' === args[ i ].type && 'undefined' === typeof options ) { options = args[ i ]; } else if ( 'TemplateLiteral' === args[ i ].type ) { finalProps[ field ] = makeDoubleQuoted( '`' + args[ i ].quasis[ 0 ].value.raw + '`' ); } } );
Promise.all( objects.slice(0, 3).map(async obj => { const originalFieldValue = obj.get('someField'); await expectAsync( deleteObject(obj.className, obj.id, { 'X-Parse-Session-Token': user4.getSessionToken(), }) ).toBeRejectedWith(jasmine.stringMatching('Object not found')); await obj.fetch({ useMasterKey: true }); expect(obj.get('someField')).toEqual(originalFieldValue); }) )
onClearTagButtonClick(event) { const index = event.target.getAttribute('data-index'); const newTags = this.state.selectedTags.slice(); newTags.splice(index, 1); this.setState({ selectedTags: newTags }); }
_clone() { const clone = super._clone(); clone._roles = this._roles.slice(); return clone; }
Promise.all( objects.slice(0, 3).map(obj => expectAsync( getObject(obj.className, obj.id, { 'X-Parse-Session-Token': user4.getSessionToken(), }) ).toBeRejectedWith(jasmine.stringMatching('Object not found')) ) )
/** * Converts the target object to an array. */ function toArray( o ) { return Array.prototype.slice.call( o ); }
var getWindowNames = function (it) { try { return gOPN(it); } catch (e) { return windowNames.slice(); } }
Promise.all( objects.slice(0, 3).map(async obj => { const originalFieldValue = obj.get('someField'); await expectAsync( deleteObject(obj.className, obj.id) ).toBeRejectedWith(jasmine.stringMatching('Object not found')); await obj.fetch({ useMasterKey: true }); expect(obj.get('someField')).toEqual(originalFieldValue); }) )
threadsWithMessageCounts .filter(t => t.messageCount > 0) .sort((a, b) => { const bc = parseInt(b.messageCount, 10); const ac = parseInt(a.messageCount, 10); return bc <= ac ? -1 : 1; }) .slice(0, 20) .map(t => t.id)
Promise.all( objects.slice(0, 3).map(async obj => { const originalFieldValue = obj.get('someField'); await expectAsync( deleteObject(obj.className, obj.id, { 'X-Parse-Session-Token': user4.getSessionToken(), }) ).toBeRejectedWith(jasmine.stringMatching('Object not found')); await obj.fetch({ useMasterKey: true }); expect(obj.get('someField')).toEqual(originalFieldValue); }) )