id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
10,900
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function() { var actions = this._actions, nActions = this._nActiveActions, bindings = this._bindings, nBindings = this._nActiveBindings; this._nActiveActions = 0; this._nActiveBindings = 0; for ( var i = 0; i !== nActions; ++ i ) { actions[ i ].reset(); } for ( var i = 0; i !== nBindings; ...
javascript
function() { var actions = this._actions, nActions = this._nActiveActions, bindings = this._bindings, nBindings = this._nActiveBindings; this._nActiveActions = 0; this._nActiveBindings = 0; for ( var i = 0; i !== nActions; ++ i ) { actions[ i ].reset(); } for ( var i = 0; i !== nBindings; ...
[ "function", "(", ")", "{", "var", "actions", "=", "this", ".", "_actions", ",", "nActions", "=", "this", ".", "_nActiveActions", ",", "bindings", "=", "this", ".", "_bindings", ",", "nBindings", "=", "this", ".", "_nActiveBindings", ";", "this", ".", "_n...
deactivates all previously scheduled actions
[ "deactivates", "all", "previously", "scheduled", "actions" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L13630-L13654
10,901
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function( clip ) { var actions = this._actions, clipUuid = clip.uuid, actionsByClip = this._actionsByClip, actionsForClip = actionsByClip[ clipUuid ]; if ( actionsForClip !== undefined ) { // note: just calling _removeInactiveAction would mess up the // iteration state and also require updating th...
javascript
function( clip ) { var actions = this._actions, clipUuid = clip.uuid, actionsByClip = this._actionsByClip, actionsForClip = actionsByClip[ clipUuid ]; if ( actionsForClip !== undefined ) { // note: just calling _removeInactiveAction would mess up the // iteration state and also require updating th...
[ "function", "(", "clip", ")", "{", "var", "actions", "=", "this", ".", "_actions", ",", "clipUuid", "=", "clip", ".", "uuid", ",", "actionsByClip", "=", "this", ".", "_actionsByClip", ",", "actionsForClip", "=", "actionsByClip", "[", "clipUuid", "]", ";", ...
free all resources specific to a particular clip
[ "free", "all", "resources", "specific", "to", "a", "particular", "clip" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L13706-L13745
10,902
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function( root ) { var rootUuid = root.uuid, actionsByClip = this._actionsByClip; for ( var clipUuid in actionsByClip ) { var actionByRoot = actionsByClip[ clipUuid ].actionByRoot, action = actionByRoot[ rootUuid ]; if ( action !== undefined ) { this._deactivateAction( action ); this._remo...
javascript
function( root ) { var rootUuid = root.uuid, actionsByClip = this._actionsByClip; for ( var clipUuid in actionsByClip ) { var actionByRoot = actionsByClip[ clipUuid ].actionByRoot, action = actionByRoot[ rootUuid ]; if ( action !== undefined ) { this._deactivateAction( action ); this._remo...
[ "function", "(", "root", ")", "{", "var", "rootUuid", "=", "root", ".", "uuid", ",", "actionsByClip", "=", "this", ".", "_actionsByClip", ";", "for", "(", "var", "clipUuid", "in", "actionsByClip", ")", "{", "var", "actionByRoot", "=", "actionsByClip", "[",...
free all resources specific to a particular root target object
[ "free", "all", "resources", "specific", "to", "a", "particular", "root", "target", "object" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L13748-L13782
10,903
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function( clip, optionalRoot ) { var action = this.existingAction( clip, optionalRoot ); if ( action !== null ) { this._deactivateAction( action ); this._removeInactiveAction( action ); } }
javascript
function( clip, optionalRoot ) { var action = this.existingAction( clip, optionalRoot ); if ( action !== null ) { this._deactivateAction( action ); this._removeInactiveAction( action ); } }
[ "function", "(", "clip", ",", "optionalRoot", ")", "{", "var", "action", "=", "this", ".", "existingAction", "(", "clip", ",", "optionalRoot", ")", ";", "if", "(", "action", "!==", "null", ")", "{", "this", ".", "_deactivateAction", "(", "action", ")", ...
remove a targeted clip from the cache
[ "remove", "a", "targeted", "clip", "from", "the", "cache" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L13785-L13796
10,904
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function( binding, rootUuid, trackName ) { var bindingsByRoot = this._bindingsByRootAndName, bindingByName = bindingsByRoot[ rootUuid ], bindings = this._bindings; if ( bindingByName === undefined ) { bindingByName = {}; bindingsByRoot[ rootUuid ] = bindingByName; } bindingByName[ trackName ] ...
javascript
function( binding, rootUuid, trackName ) { var bindingsByRoot = this._bindingsByRootAndName, bindingByName = bindingsByRoot[ rootUuid ], bindings = this._bindings; if ( bindingByName === undefined ) { bindingByName = {}; bindingsByRoot[ rootUuid ] = bindingByName; } bindingByName[ trackName ] ...
[ "function", "(", "binding", ",", "rootUuid", ",", "trackName", ")", "{", "var", "bindingsByRoot", "=", "this", ".", "_bindingsByRootAndName", ",", "bindingByName", "=", "bindingsByRoot", "[", "rootUuid", "]", ",", "bindings", "=", "this", ".", "_bindings", ";"...
Memory management for PropertyMixer objects
[ "Memory", "management", "for", "PropertyMixer", "objects" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14140-L14159
10,905
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function() { var interpolants = this._controlInterpolants, lastActiveIndex = this._nActiveControlInterpolants ++, interpolant = interpolants[ lastActiveIndex ]; if ( interpolant === undefined ) { interpolant = new THREE.LinearInterpolant( new Float32Array( 2 ), new Float32Array( 2 ), 1, this....
javascript
function() { var interpolants = this._controlInterpolants, lastActiveIndex = this._nActiveControlInterpolants ++, interpolant = interpolants[ lastActiveIndex ]; if ( interpolant === undefined ) { interpolant = new THREE.LinearInterpolant( new Float32Array( 2 ), new Float32Array( 2 ), 1, this....
[ "function", "(", ")", "{", "var", "interpolants", "=", "this", ".", "_controlInterpolants", ",", "lastActiveIndex", "=", "this", ".", "_nActiveControlInterpolants", "++", ",", "interpolant", "=", "interpolants", "[", "lastActiveIndex", "]", ";", "if", "(", "inte...
Memory management of Interpolants for weight and time scale
[ "Memory", "management", "of", "Interpolants", "for", "weight", "and", "time", "scale" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14226-L14245
10,906
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function( var_args ) { var objects = this._objects, nObjects = objects.length, nCachedObjects = this.nCachedObjects_, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length; for ( var i = 0, n = arguments.length; i !== n; ++ i ) { var object = arguments[ i ]...
javascript
function( var_args ) { var objects = this._objects, nObjects = objects.length, nCachedObjects = this.nCachedObjects_, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length; for ( var i = 0, n = arguments.length; i !== n; ++ i ) { var object = arguments[ i ]...
[ "function", "(", "var_args", ")", "{", "var", "objects", "=", "this", ".", "_objects", ",", "nObjects", "=", "objects", ".", "length", ",", "nCachedObjects", "=", "this", ".", "nCachedObjects_", ",", "indicesByUUID", "=", "this", ".", "_indicesByUUID", ",", ...
remove & forget
[ "remove", "&", "forget" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14483-L14564
10,907
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function( array, type, forceClone ) { if ( ! array || // let 'undefined' and 'null' pass ! forceClone && array.constructor === type ) return array; if ( typeof type.BYTES_PER_ELEMENT === 'number' ) { return new type( array ); // create typed array } return Array.prototype.slice.call( array ); // cre...
javascript
function( array, type, forceClone ) { if ( ! array || // let 'undefined' and 'null' pass ! forceClone && array.constructor === type ) return array; if ( typeof type.BYTES_PER_ELEMENT === 'number' ) { return new type( array ); // create typed array } return Array.prototype.slice.call( array ); // cre...
[ "function", "(", "array", ",", "type", ",", "forceClone", ")", "{", "if", "(", "!", "array", "||", "// let 'undefined' and 'null' pass", "!", "forceClone", "&&", "array", ".", "constructor", "===", "type", ")", "return", "array", ";", "if", "(", "typeof", ...
converts an array to a specific type
[ "converts", "an", "array", "to", "a", "specific", "type" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14665-L14678
10,908
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function( times ) { function compareTime( i, j ) { return times[ i ] - times[ j ]; } var n = times.length; var result = new Array( n ); for ( var i = 0; i !== n; ++ i ) result[ i ] = i; result.sort( compareTime ); return result; }
javascript
function( times ) { function compareTime( i, j ) { return times[ i ] - times[ j ]; } var n = times.length; var result = new Array( n ); for ( var i = 0; i !== n; ++ i ) result[ i ] = i; result.sort( compareTime ); return result; }
[ "function", "(", "times", ")", "{", "function", "compareTime", "(", "i", ",", "j", ")", "{", "return", "times", "[", "i", "]", "-", "times", "[", "j", "]", ";", "}", "var", "n", "=", "times", ".", "length", ";", "var", "result", "=", "new", "Ar...
returns an array by which times and values can be sorted
[ "returns", "an", "array", "by", "which", "times", "and", "values", "can", "be", "sorted" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14688-L14704
10,909
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function( values, stride, order ) { var nValues = values.length; var result = new values.constructor( nValues ); for ( var i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) { var srcOffset = order[ i ] * stride; for ( var j = 0; j !== stride; ++ j ) { result[ dstOffset ++ ] = values[ srcOffset + ...
javascript
function( values, stride, order ) { var nValues = values.length; var result = new values.constructor( nValues ); for ( var i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) { var srcOffset = order[ i ] * stride; for ( var j = 0; j !== stride; ++ j ) { result[ dstOffset ++ ] = values[ srcOffset + ...
[ "function", "(", "values", ",", "stride", ",", "order", ")", "{", "var", "nValues", "=", "values", ".", "length", ";", "var", "result", "=", "new", "values", ".", "constructor", "(", "nValues", ")", ";", "for", "(", "var", "i", "=", "0", ",", "dstO...
uses the array previously returned by 'getKeyframeOrder' to sort data
[ "uses", "the", "array", "previously", "returned", "by", "getKeyframeOrder", "to", "sort", "data" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14707-L14726
10,910
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function( jsonKeys, times, values, valuePropertyName ) { var i = 1, key = jsonKeys[ 0 ]; while ( key !== undefined && key[ valuePropertyName ] === undefined ) { key = jsonKeys[ i ++ ]; } if ( key === undefined ) return; // no data var value = key[ valuePropertyName ]; if ( value === undefined ) ret...
javascript
function( jsonKeys, times, values, valuePropertyName ) { var i = 1, key = jsonKeys[ 0 ]; while ( key !== undefined && key[ valuePropertyName ] === undefined ) { key = jsonKeys[ i ++ ]; } if ( key === undefined ) return; // no data var value = key[ valuePropertyName ]; if ( value === undefined ) ret...
[ "function", "(", "jsonKeys", ",", "times", ",", "values", ",", "valuePropertyName", ")", "{", "var", "i", "=", "1", ",", "key", "=", "jsonKeys", "[", "0", "]", ";", "while", "(", "key", "!==", "undefined", "&&", "key", "[", "valuePropertyName", "]", ...
function for parsing AOS keyframe formats
[ "function", "for", "parsing", "AOS", "keyframe", "formats" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14729-L14799
10,911
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function( timeOffset ) { if( timeOffset !== 0.0 ) { var times = this.times; for( var i = 0, n = times.length; i !== n; ++ i ) { times[ i ] += timeOffset; } } return this; }
javascript
function( timeOffset ) { if( timeOffset !== 0.0 ) { var times = this.times; for( var i = 0, n = times.length; i !== n; ++ i ) { times[ i ] += timeOffset; } } return this; }
[ "function", "(", "timeOffset", ")", "{", "if", "(", "timeOffset", "!==", "0.0", ")", "{", "var", "times", "=", "this", ".", "times", ";", "for", "(", "var", "i", "=", "0", ",", "n", "=", "times", ".", "length", ";", "i", "!==", "n", ";", "++", ...
move all keyframes either forwards or backwards in time
[ "move", "all", "keyframes", "either", "forwards", "or", "backwards", "in", "time" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L14949-L14965
10,912
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function() { var binding = this.binding; var buffer = this.buffer, stride = this.valueSize, originalValueOffset = stride * 3; binding.getValue( buffer, originalValueOffset ); // accu[0..1] := orig -- initially detect changes against the original for ( var i = stride, e = originalValueOffset; i !== ...
javascript
function() { var binding = this.binding; var buffer = this.buffer, stride = this.valueSize, originalValueOffset = stride * 3; binding.getValue( buffer, originalValueOffset ); // accu[0..1] := orig -- initially detect changes against the original for ( var i = stride, e = originalValueOffset; i !== ...
[ "function", "(", ")", "{", "var", "binding", "=", "this", ".", "binding", ";", "var", "buffer", "=", "this", ".", "buffer", ",", "stride", "=", "this", ".", "valueSize", ",", "originalValueOffset", "=", "stride", "*", "3", ";", "binding", ".", "getValu...
remember the state of the bound property and copy it to both accus
[ "remember", "the", "state", "of", "the", "bound", "property", "and", "copy", "it", "to", "both", "accus" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L16092-L16112
10,913
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function ( focalLength ) { // see http://www.bobatkins.com/photography/technical/field_of_view.html var vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; this.fov = THREE.Math.RAD2DEG * 2 * Math.atan( vExtentSlope ); this.updateProjectionMatrix(); }
javascript
function ( focalLength ) { // see http://www.bobatkins.com/photography/technical/field_of_view.html var vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; this.fov = THREE.Math.RAD2DEG * 2 * Math.atan( vExtentSlope ); this.updateProjectionMatrix(); }
[ "function", "(", "focalLength", ")", "{", "// see http://www.bobatkins.com/photography/technical/field_of_view.html", "var", "vExtentSlope", "=", "0.5", "*", "this", ".", "getFilmHeight", "(", ")", "/", "focalLength", ";", "this", ".", "fov", "=", "THREE", ".", "Mat...
Sets the FOV by focal length in respect to the current .filmGauge. The default film gauge is 35, so that the focal length can be specified for a 35mm (full frame) camera. Values for focal length and film gauge must have the same unit.
[ "Sets", "the", "FOV", "by", "focal", "length", "in", "respect", "to", "the", "current", ".", "filmGauge", "." ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L17279-L17287
10,914
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function ( t, p0, p1, p2, p3 ) { return - 3 * p0 * ( 1 - t ) * ( 1 - t ) + 3 * p1 * ( 1 - t ) * ( 1 - t ) - 6 * t * p1 * ( 1 - t ) + 6 * t * p2 * ( 1 - t ) - 3 * t * t * p2 + 3 * t * t * p3; }
javascript
function ( t, p0, p1, p2, p3 ) { return - 3 * p0 * ( 1 - t ) * ( 1 - t ) + 3 * p1 * ( 1 - t ) * ( 1 - t ) - 6 * t * p1 * ( 1 - t ) + 6 * t * p2 * ( 1 - t ) - 3 * t * t * p2 + 3 * t * t * p3; }
[ "function", "(", "t", ",", "p0", ",", "p1", ",", "p2", ",", "p3", ")", "{", "return", "-", "3", "*", "p0", "*", "(", "1", "-", "t", ")", "*", "(", "1", "-", "t", ")", "+", "3", "*", "p1", "*", "(", "1", "-", "t", ")", "*", "(", "1",...
Puay Bing, thanks for helping with this derivative!
[ "Puay", "Bing", "thanks", "for", "helping", "with", "this", "derivative!" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L33808-L33815
10,915
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function ( contour ) { var n = contour.length; var a = 0.0; for ( var p = n - 1, q = 0; q < n; p = q ++ ) { a += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y; } return a * 0.5; }
javascript
function ( contour ) { var n = contour.length; var a = 0.0; for ( var p = n - 1, q = 0; q < n; p = q ++ ) { a += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y; } return a * 0.5; }
[ "function", "(", "contour", ")", "{", "var", "n", "=", "contour", ".", "length", ";", "var", "a", "=", "0.0", ";", "for", "(", "var", "p", "=", "n", "-", "1", ",", "q", "=", "0", ";", "q", "<", "n", ";", "p", "=", "q", "++", ")", "{", "...
calculate area of the contour polygon
[ "calculate", "area", "of", "the", "contour", "polygon" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L33897-L33910
10,916
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
function( t ) { var delta = 0.0001; var t1 = t - delta; var t2 = t + delta; // Capping in case of danger if ( t1 < 0 ) t1 = 0; if ( t2 > 1 ) t2 = 1; var pt1 = this.getPoint( t1 ); var pt2 = this.getPoint( t2 ); var vec = pt2.clone().sub( pt1 ); return vec.normalize(); }
javascript
function( t ) { var delta = 0.0001; var t1 = t - delta; var t2 = t + delta; // Capping in case of danger if ( t1 < 0 ) t1 = 0; if ( t2 > 1 ) t2 = 1; var pt1 = this.getPoint( t1 ); var pt2 = this.getPoint( t2 ); var vec = pt2.clone().sub( pt1 ); return vec.normalize(); }
[ "function", "(", "t", ")", "{", "var", "delta", "=", "0.0001", ";", "var", "t1", "=", "t", "-", "delta", ";", "var", "t2", "=", "t", "+", "delta", ";", "// Capping in case of danger", "if", "(", "t1", "<", "0", ")", "t1", "=", "0", ";", "if", "...
Returns a unit vector tangent at t In case any sub curve does not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation
[ "Returns", "a", "unit", "vector", "tangent", "at", "t", "In", "case", "any", "sub", "curve", "does", "not", "implement", "its", "tangent", "derivation", "2", "points", "a", "small", "delta", "apart", "will", "be", "used", "to", "find", "its", "gradient", ...
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L34881-L34898
10,917
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
calculatePositionOnCurve
function calculatePositionOnCurve( u, p, q, radius, position ) { var cu = Math.cos( u ); var su = Math.sin( u ); var quOverP = q / p * u; var cs = Math.cos( quOverP ); position.x = radius * ( 2 + cs ) * 0.5 * cu; position.y = radius * ( 2 + cs ) * su * 0.5; position.z = radius * Math.sin( quOverP ) * 0....
javascript
function calculatePositionOnCurve( u, p, q, radius, position ) { var cu = Math.cos( u ); var su = Math.sin( u ); var quOverP = q / p * u; var cs = Math.cos( quOverP ); position.x = radius * ( 2 + cs ) * 0.5 * cu; position.y = radius * ( 2 + cs ) * su * 0.5; position.z = radius * Math.sin( quOverP ) * 0....
[ "function", "calculatePositionOnCurve", "(", "u", ",", "p", ",", "q", ",", "radius", ",", "position", ")", "{", "var", "cu", "=", "Math", ".", "cos", "(", "u", ")", ";", "var", "su", "=", "Math", ".", "sin", "(", "u", ")", ";", "var", "quOverP", ...
this function calculates the current position on the torus curve
[ "this", "function", "calculates", "the", "current", "position", "on", "the", "torus", "curve" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L39290-L39301
10,918
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
subdivide
function subdivide( face, detail ) { var cols = Math.pow( 2, detail ); var a = prepare( that.vertices[ face.a ] ); var b = prepare( that.vertices[ face.b ] ); var c = prepare( that.vertices[ face.c ] ); var v = []; // Construct all of the vertices for this subdivision. for ( var i = 0 ; i <= cols; i ++...
javascript
function subdivide( face, detail ) { var cols = Math.pow( 2, detail ); var a = prepare( that.vertices[ face.a ] ); var b = prepare( that.vertices[ face.b ] ); var c = prepare( that.vertices[ face.c ] ); var v = []; // Construct all of the vertices for this subdivision. for ( var i = 0 ; i <= cols; i ++...
[ "function", "subdivide", "(", "face", ",", "detail", ")", "{", "var", "cols", "=", "Math", ".", "pow", "(", "2", ",", "detail", ")", ";", "var", "a", "=", "prepare", "(", "that", ".", "vertices", "[", "face", ".", "a", "]", ")", ";", "var", "b"...
Analytically subdivide a face to the required detail level.
[ "Analytically", "subdivide", "a", "face", "to", "the", "required", "detail", "level", "." ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L39786-L39850
10,919
AlloyTeam/AlloyTouch
example/threejs/asset/three.js
inclination
function inclination( vector ) { return Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) ); }
javascript
function inclination( vector ) { return Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) ); }
[ "function", "inclination", "(", "vector", ")", "{", "return", "Math", ".", "atan2", "(", "-", "vector", ".", "y", ",", "Math", ".", "sqrt", "(", "(", "vector", ".", "x", "*", "vector", ".", "x", ")", "+", "(", "vector", ".", "z", "*", "vector", ...
Angle above the XZ plane.
[ "Angle", "above", "the", "XZ", "plane", "." ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/example/threejs/asset/three.js#L39864-L39868
10,920
AlloyTeam/AlloyTouch
select/index.js
_mergeListInfo
function _mergeListInfo(list) { var arr = []; var info = {}; for(var i=0,len=list.length; i<len; i++) { arr.push('<li data-value="'+list[i].value+'">' + list[i].name + '</li>'); info[i] = list[i].list ? _mergeListInfo(list[i].list) : {length: 0}...
javascript
function _mergeListInfo(list) { var arr = []; var info = {}; for(var i=0,len=list.length; i<len; i++) { arr.push('<li data-value="'+list[i].value+'">' + list[i].name + '</li>'); info[i] = list[i].list ? _mergeListInfo(list[i].list) : {length: 0}...
[ "function", "_mergeListInfo", "(", "list", ")", "{", "var", "arr", "=", "[", "]", ";", "var", "info", "=", "{", "}", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "list", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "...
merge options list
[ "merge", "options", "list" ]
4f93a9232a817bd2bfdcc67b46748dc423a2f3ed
https://github.com/AlloyTeam/AlloyTouch/blob/4f93a9232a817bd2bfdcc67b46748dc423a2f3ed/select/index.js#L31-L43
10,921
socketio/socket.io-redis
index.js
Redis
function Redis(nsp){ Adapter.call(this, nsp); this.uid = uid; this.prefix = prefix; this.requestsTimeout = requestsTimeout; this.channel = prefix + '#' + nsp.name + '#'; this.requestChannel = prefix + '-request#' + this.nsp.name + '#'; this.responseChannel = prefix + '-response#' + this.ns...
javascript
function Redis(nsp){ Adapter.call(this, nsp); this.uid = uid; this.prefix = prefix; this.requestsTimeout = requestsTimeout; this.channel = prefix + '#' + nsp.name + '#'; this.requestChannel = prefix + '-request#' + this.nsp.name + '#'; this.responseChannel = prefix + '-response#' + this.ns...
[ "function", "Redis", "(", "nsp", ")", "{", "Adapter", ".", "call", "(", "this", ",", "nsp", ")", ";", "this", ".", "uid", "=", "uid", ";", "this", ".", "prefix", "=", "prefix", ";", "this", ".", "requestsTimeout", "=", "requestsTimeout", ";", "this",...
Adapter constructor. @param {String} namespace name @api public
[ "Adapter", "constructor", "." ]
a1cebc8649584fa08eb1e0b933f9eca980d23ea5
https://github.com/socketio/socket.io-redis/blob/a1cebc8649584fa08eb1e0b933f9eca980d23ea5/index.js#L78-L122
10,922
casperjs/casperjs
modules/colorizer.js
Dummy
function Dummy() { "use strict"; this.colorize = function colorize(text, styleName, pad) { return text; }; this.format = function format(text, style, pad){ return text; }; }
javascript
function Dummy() { "use strict"; this.colorize = function colorize(text, styleName, pad) { return text; }; this.format = function format(text, style, pad){ return text; }; }
[ "function", "Dummy", "(", ")", "{", "\"use strict\"", ";", "this", ".", "colorize", "=", "function", "colorize", "(", "text", ",", "styleName", ",", "pad", ")", "{", "return", "text", ";", "}", ";", "this", ".", "format", "=", "function", "format", "("...
Dummy colorizer. Does basically nothing.
[ "Dummy", "colorizer", ".", "Does", "basically", "nothing", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/colorizer.js#L126-L134
10,923
casperjs/casperjs
modules/xunit.js
generateClassName
function generateClassName(classname) { "use strict"; classname = (classname || "").replace(phantom.casperPath, "").trim(); var script = classname || phantom.casperScript || ""; if (script.indexOf(fs.workingDirectory) === 0) { script = script.substring(fs.workingDirectory.length + 1); } ...
javascript
function generateClassName(classname) { "use strict"; classname = (classname || "").replace(phantom.casperPath, "").trim(); var script = classname || phantom.casperScript || ""; if (script.indexOf(fs.workingDirectory) === 0) { script = script.substring(fs.workingDirectory.length + 1); } ...
[ "function", "generateClassName", "(", "classname", ")", "{", "\"use strict\"", ";", "classname", "=", "(", "classname", "||", "\"\"", ")", ".", "replace", "(", "phantom", ".", "casperPath", ",", "\"\"", ")", ".", "trim", "(", ")", ";", "var", "script", "...
Generates a value for 'classname' attribute of the JUnit XML report. Uses the (relative) file name of the current casper script without file extension as classname. @param String classname @return String
[ "Generates", "a", "value", "for", "classname", "attribute", "of", "the", "JUnit", "XML", "report", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/xunit.js#L47-L65
10,924
casperjs/casperjs
bin/bootstrap.js
printHelp
function printHelp() { /* global slimer */ var engine = phantom.casperEngine === 'slimerjs' ? slimer : phantom; var version = [engine.version.major, engine.version.minor, engine.version.patch].join('.'); return __terminate([ 'CasperJS version ' + phantom.casperVersion.toStrin...
javascript
function printHelp() { /* global slimer */ var engine = phantom.casperEngine === 'slimerjs' ? slimer : phantom; var version = [engine.version.major, engine.version.minor, engine.version.patch].join('.'); return __terminate([ 'CasperJS version ' + phantom.casperVersion.toStrin...
[ "function", "printHelp", "(", ")", "{", "/* global slimer */", "var", "engine", "=", "phantom", ".", "casperEngine", "===", "'slimerjs'", "?", "slimer", ":", "phantom", ";", "var", "version", "=", "[", "engine", ".", "version", ".", "major", ",", "engine", ...
Prints CasperJS help.
[ "Prints", "CasperJS", "help", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/bin/bootstrap.js#L213-L222
10,925
casperjs/casperjs
samples/dynamic.js
check
function check() { if (links[currentLink] && currentLink < upTo) { this.echo('--- Link ' + currentLink + ' ---'); start.call(this, links[currentLink]); addLinks.call(this, links[currentLink]); currentLink++; this.run(check); } else { this.echo("All done."); ...
javascript
function check() { if (links[currentLink] && currentLink < upTo) { this.echo('--- Link ' + currentLink + ' ---'); start.call(this, links[currentLink]); addLinks.call(this, links[currentLink]); currentLink++; this.run(check); } else { this.echo("All done."); ...
[ "function", "check", "(", ")", "{", "if", "(", "links", "[", "currentLink", "]", "&&", "currentLink", "<", "upTo", ")", "{", "this", ".", "echo", "(", "'--- Link '", "+", "currentLink", "+", "' ---'", ")", ";", "start", ".", "call", "(", "this", ",",...
As long as it has a next link, and is under the maximum limit, will keep running
[ "As", "long", "as", "it", "has", "a", "next", "link", "and", "is", "under", "the", "maximum", "limit", "will", "keep", "running" ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/samples/dynamic.js#L51-L62
10,926
casperjs/casperjs
modules/cli.js
castArgument
function castArgument(arg) { "use strict"; if (arg.match(/^-?\d+$/)) { return parseInt(arg, 10); } else if (arg.match(/^-?\d+\.\d+$/)) { return parseFloat(arg); } else if (arg.match(/^(true|false)$/i)) { return arg.trim().toLowerCase() === "true" ? true : false; } else { ...
javascript
function castArgument(arg) { "use strict"; if (arg.match(/^-?\d+$/)) { return parseInt(arg, 10); } else if (arg.match(/^-?\d+\.\d+$/)) { return parseFloat(arg); } else if (arg.match(/^(true|false)$/i)) { return arg.trim().toLowerCase() === "true" ? true : false; } else { ...
[ "function", "castArgument", "(", "arg", ")", "{", "\"use strict\"", ";", "if", "(", "arg", ".", "match", "(", "/", "^-?\\d+$", "/", ")", ")", "{", "return", "parseInt", "(", "arg", ",", "10", ")", ";", "}", "else", "if", "(", "arg", ".", "match", ...
Cast a string argument to its typed equivalent. @param String arg @return Mixed
[ "Cast", "a", "string", "argument", "to", "its", "typed", "equivalent", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/cli.js#L138-L149
10,927
casperjs/casperjs
modules/utils.js
betterTypeOf
function betterTypeOf(input) { "use strict"; switch (input) { case undefined: return 'undefined'; case null: return 'null'; default: try { var type = Object.prototype.toString.call(input).match(/^\[object\s(.*)\]$/)[1].toLowerCase(); ...
javascript
function betterTypeOf(input) { "use strict"; switch (input) { case undefined: return 'undefined'; case null: return 'null'; default: try { var type = Object.prototype.toString.call(input).match(/^\[object\s(.*)\]$/)[1].toLowerCase(); ...
[ "function", "betterTypeOf", "(", "input", ")", "{", "\"use strict\"", ";", "switch", "(", "input", ")", "{", "case", "undefined", ":", "return", "'undefined'", ";", "case", "null", ":", "return", "'null'", ";", "default", ":", "try", "{", "var", "type", ...
Provides a better typeof operator equivalent, able to retrieve the array type. CAVEAT: this function does not necessarilly map to classical js "type" names, notably a `null` will map to "null" instead of "object". @param mixed input @return String @see http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-...
[ "Provides", "a", "better", "typeof", "operator", "equivalent", "able", "to", "retrieve", "the", "array", "type", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L45-L69
10,928
casperjs/casperjs
modules/utils.js
betterInstanceOf
function betterInstanceOf(input, constructor) { "use strict"; /*eslint eqeqeq:0 */ if (typeof input == 'undefined' || input == null) { return false; } var inputToTest = input; while (inputToTest != null) { if (inputToTest == constructor.prototype) { return true; } ...
javascript
function betterInstanceOf(input, constructor) { "use strict"; /*eslint eqeqeq:0 */ if (typeof input == 'undefined' || input == null) { return false; } var inputToTest = input; while (inputToTest != null) { if (inputToTest == constructor.prototype) { return true; } ...
[ "function", "betterInstanceOf", "(", "input", ",", "constructor", ")", "{", "\"use strict\"", ";", "/*eslint eqeqeq:0 */", "if", "(", "typeof", "input", "==", "'undefined'", "||", "input", "==", "null", ")", "{", "return", "false", ";", "}", "var", "inputToTes...
Provides a better instanceof operator, capable of checking against the full object prototype hierarchy. @param mixed input @param function constructor @return String @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Details_of_the_Object_Model
[ "Provides", "a", "better", "instanceof", "operator", "capable", "of", "checking", "against", "the", "full", "object", "prototype", "hierarchy", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L80-L100
10,929
casperjs/casperjs
modules/utils.js
cleanUrl
function cleanUrl(url) { "use strict"; if (url.toLowerCase().indexOf('http') !== 0) { return url; } var a = document.createElement('a'); a.href = url; return a.href; }
javascript
function cleanUrl(url) { "use strict"; if (url.toLowerCase().indexOf('http') !== 0) { return url; } var a = document.createElement('a'); a.href = url; return a.href; }
[ "function", "cleanUrl", "(", "url", ")", "{", "\"use strict\"", ";", "if", "(", "url", ".", "toLowerCase", "(", ")", ".", "indexOf", "(", "'http'", ")", "!==", "0", ")", "{", "return", "url", ";", "}", "var", "a", "=", "document", ".", "createElement...
Cleans a passed URL. @param String url An HTTP URL @return String
[ "Cleans", "a", "passed", "URL", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L109-L117
10,930
casperjs/casperjs
modules/utils.js
computeModifier
function computeModifier(modifierString, modifiers) { "use strict"; var modifier = 0, checkKey = function(key) { if (key in modifiers) return; throw new CasperError(format('%s is not a supported key modifier', key)); }; if (!modifierString) return modifier; var ke...
javascript
function computeModifier(modifierString, modifiers) { "use strict"; var modifier = 0, checkKey = function(key) { if (key in modifiers) return; throw new CasperError(format('%s is not a supported key modifier', key)); }; if (!modifierString) return modifier; var ke...
[ "function", "computeModifier", "(", "modifierString", ",", "modifiers", ")", "{", "\"use strict\"", ";", "var", "modifier", "=", "0", ",", "checkKey", "=", "function", "(", "key", ")", "{", "if", "(", "key", "in", "modifiers", ")", "return", ";", "throw", ...
Computes a modifier string to its PhantomJS equivalent. A modifier string is in the form "ctrl+alt+shift". @param String modifierString Modifier string, eg. "ctrl+alt+shift" @param Object modifiers Modifiers definitions @return Number
[ "Computes", "a", "modifier", "string", "to", "its", "PhantomJS", "equivalent", ".", "A", "modifier", "string", "is", "in", "the", "form", "ctrl", "+", "alt", "+", "shift", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L140-L153
10,931
casperjs/casperjs
modules/utils.js
equals
function equals(v1, v2) { "use strict"; if (isFunction(v1)) { return v1.toString() === v2.toString(); } // with Gecko, instanceof is not enough to test object if (v1 instanceof Object || isObject(v1)) { if (!(v2 instanceof Object || isObject(v2)) || Object.keys(v1).length...
javascript
function equals(v1, v2) { "use strict"; if (isFunction(v1)) { return v1.toString() === v2.toString(); } // with Gecko, instanceof is not enough to test object if (v1 instanceof Object || isObject(v1)) { if (!(v2 instanceof Object || isObject(v2)) || Object.keys(v1).length...
[ "function", "equals", "(", "v1", ",", "v2", ")", "{", "\"use strict\"", ";", "if", "(", "isFunction", "(", "v1", ")", ")", "{", "return", "v1", ".", "toString", "(", ")", "===", "v2", ".", "toString", "(", ")", ";", "}", "// with Gecko, instanceof is n...
Tests equality between the two passed arguments. @param Mixed v1 @param Mixed v2 @param Boolean
[ "Tests", "equality", "between", "the", "two", "passed", "arguments", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L191-L210
10,932
casperjs/casperjs
modules/utils.js
fillBlanks
function fillBlanks(text, pad) { "use strict"; pad = pad || 80; if (text.length < pad) { text += new Array(pad - text.length + 1).join(' '); } return text; }
javascript
function fillBlanks(text, pad) { "use strict"; pad = pad || 80; if (text.length < pad) { text += new Array(pad - text.length + 1).join(' '); } return text; }
[ "function", "fillBlanks", "(", "text", ",", "pad", ")", "{", "\"use strict\"", ";", "pad", "=", "pad", "||", "80", ";", "if", "(", "text", ".", "length", "<", "pad", ")", "{", "text", "+=", "new", "Array", "(", "pad", "-", "text", ".", "length", ...
Takes a string and append blanks until the pad value is reached. @param String text @param Number pad Pad value (optional; default: 80) @return String
[ "Takes", "a", "string", "and", "append", "blanks", "until", "the", "pad", "value", "is", "reached", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L236-L243
10,933
casperjs/casperjs
modules/utils.js
getPropertyPath
function getPropertyPath(obj, path) { "use strict"; if (!isObject(obj) || !isString(path)) { return undefined; } var value = obj; path.split('.').forEach(function(property) { if (typeof value === "object" && property in value) { value = value[property]; } else { ...
javascript
function getPropertyPath(obj, path) { "use strict"; if (!isObject(obj) || !isString(path)) { return undefined; } var value = obj; path.split('.').forEach(function(property) { if (typeof value === "object" && property in value) { value = value[property]; } else { ...
[ "function", "getPropertyPath", "(", "obj", ",", "path", ")", "{", "\"use strict\"", ";", "if", "(", "!", "isObject", "(", "obj", ")", "||", "!", "isString", "(", "path", ")", ")", "{", "return", "undefined", ";", "}", "var", "value", "=", "obj", ";",...
Retrieves the value of an Object foreign property using a dot-separated path string. Beware, this function doesn't handle object key names containing a dot. @param Object obj The source object @param String path Dot separated path, eg. "x.y.z"
[ "Retrieves", "the", "value", "of", "an", "Object", "foreign", "property", "using", "a", "dot", "-", "separated", "path", "string", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L328-L342
10,934
casperjs/casperjs
modules/utils.js
indent
function indent(string, nchars, prefix) { "use strict"; return string.split('\n').map(function(line) { return (prefix || '') + new Array(nchars).join(' ') + line; }).join('\n'); }
javascript
function indent(string, nchars, prefix) { "use strict"; return string.split('\n').map(function(line) { return (prefix || '') + new Array(nchars).join(' ') + line; }).join('\n'); }
[ "function", "indent", "(", "string", ",", "nchars", ",", "prefix", ")", "{", "\"use strict\"", ";", "return", "string", ".", "split", "(", "'\\n'", ")", ".", "map", "(", "function", "(", "line", ")", "{", "return", "(", "prefix", "||", "''", ")", "+"...
Indents a string. @param String string @param Number nchars @param String prefix @return String
[ "Indents", "a", "string", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L353-L358
10,935
casperjs/casperjs
modules/utils.js
isClipRect
function isClipRect(value) { "use strict"; return isType(value, "cliprect") || ( isObject(value) && isNumber(value.top) && isNumber(value.left) && isNumber(value.width) && isNumber(value.height) ); }
javascript
function isClipRect(value) { "use strict"; return isType(value, "cliprect") || ( isObject(value) && isNumber(value.top) && isNumber(value.left) && isNumber(value.width) && isNumber(value.height) ); }
[ "function", "isClipRect", "(", "value", ")", "{", "\"use strict\"", ";", "return", "isType", "(", "value", ",", "\"cliprect\"", ")", "||", "(", "isObject", "(", "value", ")", "&&", "isNumber", "(", "value", ".", "top", ")", "&&", "isNumber", "(", "value"...
Checks if value is a phantomjs clipRect-compatible object @param mixed value @return Boolean
[ "Checks", "if", "value", "is", "a", "phantomjs", "clipRect", "-", "compatible", "object" ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L412-L419
10,936
casperjs/casperjs
modules/utils.js
isType
function isType(what, typeName) { "use strict"; if (typeof typeName !== "string" || !typeName) { throw new CasperError("You must pass isType() a typeName string"); } return betterTypeOf(what).toLowerCase() === typeName.toLowerCase(); }
javascript
function isType(what, typeName) { "use strict"; if (typeof typeName !== "string" || !typeName) { throw new CasperError("You must pass isType() a typeName string"); } return betterTypeOf(what).toLowerCase() === typeName.toLowerCase(); }
[ "function", "isType", "(", "what", ",", "typeName", ")", "{", "\"use strict\"", ";", "if", "(", "typeof", "typeName", "!==", "\"string\"", "||", "!", "typeName", ")", "{", "throw", "new", "CasperError", "(", "\"You must pass isType() a typeName string\"", ")", "...
Shorthands for checking if a value is of the given type. Can check for arrays. @param mixed what The value to check @param String typeName The type name ("string", "number", "function", etc.) @return Boolean
[ "Shorthands", "for", "checking", "if", "a", "value", "is", "of", "the", "given", "type", ".", "Can", "check", "for", "arrays", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L557-L563
10,937
casperjs/casperjs
modules/utils.js
isValidSelector
function isValidSelector(value) { "use strict"; if (isString(value)) { try { // phantomjs env has a working document object, let's use it document.querySelector(value); } catch(e) { if ('name' in e && (e.name === 'SYNTAX_ERR' || e.name === 'SyntaxError')) { ...
javascript
function isValidSelector(value) { "use strict"; if (isString(value)) { try { // phantomjs env has a working document object, let's use it document.querySelector(value); } catch(e) { if ('name' in e && (e.name === 'SYNTAX_ERR' || e.name === 'SyntaxError')) { ...
[ "function", "isValidSelector", "(", "value", ")", "{", "\"use strict\"", ";", "if", "(", "isString", "(", "value", ")", ")", "{", "try", "{", "// phantomjs env has a working document object, let's use it", "document", ".", "querySelector", "(", "value", ")", ";", ...
Checks if value is a valid selector Object. @param mixed value @return Boolean
[ "Checks", "if", "value", "is", "a", "valid", "selector", "Object", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L583-L608
10,938
casperjs/casperjs
modules/utils.js
mergeObjectsInGecko
function mergeObjectsInGecko(origin, add, opts) { "use strict"; var options = opts || {}, keepReferences = options.keepReferences; for (var p in add) { if (isPlainObject(add[p])) { if (isPlainObject(origin[p])) { origin[p] = mergeObjects(origin[p], add[p]); ...
javascript
function mergeObjectsInGecko(origin, add, opts) { "use strict"; var options = opts || {}, keepReferences = options.keepReferences; for (var p in add) { if (isPlainObject(add[p])) { if (isPlainObject(origin[p])) { origin[p] = mergeObjects(origin[p], add[p]); ...
[ "function", "mergeObjectsInGecko", "(", "origin", ",", "add", ",", "opts", ")", "{", "\"use strict\"", ";", "var", "options", "=", "opts", "||", "{", "}", ",", "keepReferences", "=", "options", ".", "keepReferences", ";", "for", "(", "var", "p", "in", "a...
Object recursive merging utility for use in the SlimerJS environment @param Object origin the origin object @param Object add the object to merge data into origin @param Object opts optional options to be passed in @return Object
[ "Object", "recursive", "merging", "utility", "for", "use", "in", "the", "SlimerJS", "environment" ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L641-L670
10,939
casperjs/casperjs
modules/utils.js
serialize
function serialize(value, indent) { "use strict"; if (isArray(value)) { value = value.map(function _map(prop) { return isFunction(prop) ? prop.toString().replace(/\s{2,}/, '') : prop; }); } return JSON.stringify(value, null, indent); }
javascript
function serialize(value, indent) { "use strict"; if (isArray(value)) { value = value.map(function _map(prop) { return isFunction(prop) ? prop.toString().replace(/\s{2,}/, '') : prop; }); } return JSON.stringify(value, null, indent); }
[ "function", "serialize", "(", "value", ",", "indent", ")", "{", "\"use strict\"", ";", "if", "(", "isArray", "(", "value", ")", ")", "{", "value", "=", "value", ".", "map", "(", "function", "_map", "(", "prop", ")", "{", "return", "isFunction", "(", ...
Serializes a value using JSON. @param Mixed value @return String
[ "Serializes", "a", "value", "using", "JSON", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L776-L784
10,940
casperjs/casperjs
modules/utils.js
unique
function unique(array) { "use strict"; var o = {}, r = []; for (var i = 0, len = array.length; i !== len; i++) { var d = array[i]; if (typeof o[d] === "undefined") { o[d] = 1; r[r.length] = d; } } return r; }
javascript
function unique(array) { "use strict"; var o = {}, r = []; for (var i = 0, len = array.length; i !== len; i++) { var d = array[i]; if (typeof o[d] === "undefined") { o[d] = 1; r[r.length] = d; } } return r; }
[ "function", "unique", "(", "array", ")", "{", "\"use strict\"", ";", "var", "o", "=", "{", "}", ",", "r", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "array", ".", "length", ";", "i", "!==", "len", ";", "i", "++", ...
Returns unique values from an array. Note: ugly code is ugly, but efficient: http://jsperf.com/array-unique2/8 @param Array array @return Array
[ "Returns", "unique", "values", "from", "an", "array", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L795-L807
10,941
casperjs/casperjs
modules/utils.js
versionToString
function versionToString(version) { if (isObject(version)) { try { return [version.major, version.minor, version.patch].join('.'); } catch (e) {} } return version; }
javascript
function versionToString(version) { if (isObject(version)) { try { return [version.major, version.minor, version.patch].join('.'); } catch (e) {} } return version; }
[ "function", "versionToString", "(", "version", ")", "{", "if", "(", "isObject", "(", "version", ")", ")", "{", "try", "{", "return", "[", "version", ".", "major", ",", "version", ".", "minor", ",", "version", ".", "patch", "]", ".", "join", "(", "'.'...
Convert a version object to a string. @param Mixed version a version string or object
[ "Convert", "a", "version", "object", "to", "a", "string", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L815-L822
10,942
casperjs/casperjs
modules/utils.js
matchEngine
function matchEngine(matchSpec) { if (Array !== matchSpec.constructor) { matchSpec = [matchSpec]; } var idx; var len = matchSpec.length; var engineName = phantom.casperEngine; var engineVersion = phantom.version; for (idx = 0; idx < len; ++idx) { var match = matchSpec[idx];...
javascript
function matchEngine(matchSpec) { if (Array !== matchSpec.constructor) { matchSpec = [matchSpec]; } var idx; var len = matchSpec.length; var engineName = phantom.casperEngine; var engineVersion = phantom.version; for (idx = 0; idx < len; ++idx) { var match = matchSpec[idx];...
[ "function", "matchEngine", "(", "matchSpec", ")", "{", "if", "(", "Array", "!==", "matchSpec", ".", "constructor", ")", "{", "matchSpec", "=", "[", "matchSpec", "]", ";", "}", "var", "idx", ";", "var", "len", "=", "matchSpec", ".", "length", ";", "var"...
Checks if the engine matches a specifier. A match specifier is an object of the form: { name: 'casperjs' | 'phantomjs', version: { min: Object, max: Object }, message: String } Minimal and maximal versions to be matched are determined using utils.cmpVersion. @param Mixed matchSpec a single match specifier o...
[ "Checks", "if", "the", "engine", "matches", "a", "specifier", "." ]
4c236d0e139ca5dc90c91acd364445025e7a1522
https://github.com/casperjs/casperjs/blob/4c236d0e139ca5dc90c91acd364445025e7a1522/modules/utils.js#L896-L925
10,943
node-cron/node-cron
src/node-cron.js
schedule
function schedule(expression, func, options) { let task = createTask(expression, func, options); storage.save(task); return task; }
javascript
function schedule(expression, func, options) { let task = createTask(expression, func, options); storage.save(task); return task; }
[ "function", "schedule", "(", "expression", ",", "func", ",", "options", ")", "{", "let", "task", "=", "createTask", "(", "expression", ",", "func", ",", "options", ")", ";", "storage", ".", "save", "(", "task", ")", ";", "return", "task", ";", "}" ]
Creates a new task to execute given function when the cron expression ticks. @param {string} expression - cron expression. @param {Function} func - task to be executed. @param {Object} options - a set of options for the scheduled task: - scheduled <boolean>: if a schaduled task is ready and running to be performed whe...
[ "Creates", "a", "new", "task", "to", "execute", "given", "function", "when", "the", "cron", "expression", "ticks", "." ]
2a3970390b8dffa20b0a1bbf5ba2f71e8b4405d2
https://github.com/node-cron/node-cron/blob/2a3970390b8dffa20b0a1bbf5ba2f71e8b4405d2/src/node-cron.js#L29-L33
10,944
fengyuanchen/viewer
dist/viewer.common.js
getImageNaturalSizes
function getImageNaturalSizes(image, callback) { var newImage = document.createElement('img'); // Modern browsers (except Safari) if (image.naturalWidth && !IS_SAFARI) { callback(image.naturalWidth, image.naturalHeight); return newImage; } var body = document.body || document.documentElement; new...
javascript
function getImageNaturalSizes(image, callback) { var newImage = document.createElement('img'); // Modern browsers (except Safari) if (image.naturalWidth && !IS_SAFARI) { callback(image.naturalWidth, image.naturalHeight); return newImage; } var body = document.body || document.documentElement; new...
[ "function", "getImageNaturalSizes", "(", "image", ",", "callback", ")", "{", "var", "newImage", "=", "document", ".", "createElement", "(", "'img'", ")", ";", "// Modern browsers (except Safari)", "if", "(", "image", ".", "naturalWidth", "&&", "!", "IS_SAFARI", ...
Get an image's natural sizes. @param {string} image - The target image. @param {Function} callback - The callback function. @returns {HTMLImageElement} The new image.
[ "Get", "an", "image", "s", "natural", "sizes", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L713-L742
10,945
fengyuanchen/viewer
dist/viewer.common.js
onViewed
function onViewed() { var imageData = _this.imageData; title.textContent = alt + ' (' + imageData.naturalWidth + ' \xD7 ' + imageData.naturalHeight + ')'; }
javascript
function onViewed() { var imageData = _this.imageData; title.textContent = alt + ' (' + imageData.naturalWidth + ' \xD7 ' + imageData.naturalHeight + ')'; }
[ "function", "onViewed", "(", ")", "{", "var", "imageData", "=", "_this", ".", "imageData", ";", "title", ".", "textContent", "=", "alt", "+", "' ('", "+", "imageData", ".", "naturalWidth", "+", "' \\xD7 '", "+", "imageData", ".", "naturalHeight", "+", "')'...
Generate title after viewed
[ "Generate", "title", "after", "viewed" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1724-L1729
10,946
fengyuanchen/viewer
dist/viewer.common.js
prev
function prev() { var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var index = this.index - 1; if (index < 0) { index = loop ? this.length - 1 : 0; } this.view(index); return this; }
javascript
function prev() { var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var index = this.index - 1; if (index < 0) { index = loop ? this.length - 1 : 0; } this.view(index); return this; }
[ "function", "prev", "(", ")", "{", "var", "loop", "=", "arguments", ".", "length", ">", "0", "&&", "arguments", "[", "0", "]", "!==", "undefined", "?", "arguments", "[", "0", "]", ":", "false", ";", "var", "index", "=", "this", ".", "index", "-", ...
View the previous image @param {boolean} [loop=false] - Indicate if view the last one when it is the first one at present. @returns {Viewer} this
[ "View", "the", "previous", "image" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1784-L1795
10,947
fengyuanchen/viewer
dist/viewer.common.js
next
function next() { var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var maxIndex = this.length - 1; var index = this.index + 1; if (index > maxIndex) { index = loop ? 0 : maxIndex; } this.view(index); return this; }
javascript
function next() { var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var maxIndex = this.length - 1; var index = this.index + 1; if (index > maxIndex) { index = loop ? 0 : maxIndex; } this.view(index); return this; }
[ "function", "next", "(", ")", "{", "var", "loop", "=", "arguments", ".", "length", ">", "0", "&&", "arguments", "[", "0", "]", "!==", "undefined", "?", "arguments", "[", "0", "]", ":", "false", ";", "var", "maxIndex", "=", "this", ".", "length", "-...
View the next image @param {boolean} [loop=false] - Indicate if view the first one when it is the last one at present. @returns {Viewer} this
[ "View", "the", "next", "image" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1804-L1816
10,948
fengyuanchen/viewer
dist/viewer.common.js
move
function move(offsetX, offsetY) { var imageData = this.imageData; this.moveTo(isUndefined(offsetX) ? offsetX : imageData.left + Number(offsetX), isUndefined(offsetY) ? offsetY : imageData.top + Number(offsetY)); return this; }
javascript
function move(offsetX, offsetY) { var imageData = this.imageData; this.moveTo(isUndefined(offsetX) ? offsetX : imageData.left + Number(offsetX), isUndefined(offsetY) ? offsetY : imageData.top + Number(offsetY)); return this; }
[ "function", "move", "(", "offsetX", ",", "offsetY", ")", "{", "var", "imageData", "=", "this", ".", "imageData", ";", "this", ".", "moveTo", "(", "isUndefined", "(", "offsetX", ")", "?", "offsetX", ":", "imageData", ".", "left", "+", "Number", "(", "of...
Move the image with relative offsets. @param {number} offsetX - The relative offset distance on the x-axis. @param {number} offsetY - The relative offset distance on the y-axis. @returns {Viewer} this
[ "Move", "the", "image", "with", "relative", "offsets", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1825-L1832
10,949
fengyuanchen/viewer
dist/viewer.common.js
moveTo
function moveTo(x) { var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x; var imageData = this.imageData; x = Number(x); y = Number(y); if (this.viewed && !this.played && this.options.movable) { var changed = false; if (isNumber(x)) { imageData.left ...
javascript
function moveTo(x) { var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x; var imageData = this.imageData; x = Number(x); y = Number(y); if (this.viewed && !this.played && this.options.movable) { var changed = false; if (isNumber(x)) { imageData.left ...
[ "function", "moveTo", "(", "x", ")", "{", "var", "y", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "x", ";", "var", "imageData", "=", "this", ".", "imageData"...
Move the image to an absolute point. @param {number} x - The x-axis coordinate. @param {number} [y=x] - The y-axis coordinate. @returns {Viewer} this
[ "Move", "the", "image", "to", "an", "absolute", "point", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1841-L1868
10,950
fengyuanchen/viewer
dist/viewer.common.js
zoom
function zoom(ratio) { var hasTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var imageData = this.imageData; ratio = Number(ratio); if (ratio < 0) { ratio =...
javascript
function zoom(ratio) { var hasTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var imageData = this.imageData; ratio = Number(ratio); if (ratio < 0) { ratio =...
[ "function", "zoom", "(", "ratio", ")", "{", "var", "hasTooltip", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "false", ";", "var", "_originalEvent", "=", "argumen...
Zoom the image with a relative ratio. @param {number} ratio - The target ratio. @param {boolean} [hasTooltip=false] - Indicates if it has a tooltip or not. @param {Event} [_originalEvent=null] - The original event if any. @returns {Viewer} this
[ "Zoom", "the", "image", "with", "a", "relative", "ratio", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1878-L1897
10,951
fengyuanchen/viewer
dist/viewer.common.js
zoomTo
function zoomTo(ratio) { var hasTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var _zoomable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; ...
javascript
function zoomTo(ratio) { var hasTooltip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var _originalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var _zoomable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; ...
[ "function", "zoomTo", "(", "ratio", ")", "{", "var", "hasTooltip", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "false", ";", "var", "_originalEvent", "=", "argum...
Zoom the image to an absolute ratio. @param {number} ratio - The target ratio. @param {boolean} [hasTooltip=false] - Indicates if it has a tooltip or not. @param {Event} [_originalEvent=null] - The original event if any. @param {Event} [_zoomable=false] - Indicates if the current zoom is available or not. @returns {Vie...
[ "Zoom", "the", "image", "to", "an", "absolute", "ratio", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1908-L1964
10,952
fengyuanchen/viewer
dist/viewer.common.js
rotateTo
function rotateTo(degree) { var imageData = this.imageData; degree = Number(degree); if (isNumber(degree) && this.viewed && !this.played && this.options.rotatable) { imageData.rotate = degree; this.renderImage(); } return this; }
javascript
function rotateTo(degree) { var imageData = this.imageData; degree = Number(degree); if (isNumber(degree) && this.viewed && !this.played && this.options.rotatable) { imageData.rotate = degree; this.renderImage(); } return this; }
[ "function", "rotateTo", "(", "degree", ")", "{", "var", "imageData", "=", "this", ".", "imageData", ";", "degree", "=", "Number", "(", "degree", ")", ";", "if", "(", "isNumber", "(", "degree", ")", "&&", "this", ".", "viewed", "&&", "!", "this", ".",...
Rotate the image to an absolute degree. @param {number} degree - The rotate degree. @returns {Viewer} this
[ "Rotate", "the", "image", "to", "an", "absolute", "degree", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L1984-L1996
10,953
fengyuanchen/viewer
dist/viewer.common.js
scale
function scale(scaleX) { var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX; var imageData = this.imageData; scaleX = Number(scaleX); scaleY = Number(scaleY); if (this.viewed && !this.played && this.options.scalable) { var changed = false; if (isN...
javascript
function scale(scaleX) { var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX; var imageData = this.imageData; scaleX = Number(scaleX); scaleY = Number(scaleY); if (this.viewed && !this.played && this.options.scalable) { var changed = false; if (isN...
[ "function", "scale", "(", "scaleX", ")", "{", "var", "scaleY", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "scaleX", ";", "var", "imageData", "=", "this", ".",...
Scale the image. @param {number} scaleX - The scale ratio on the x-axis. @param {number} [scaleY=scaleX] - The scale ratio on the y-axis. @returns {Viewer} this
[ "Scale", "the", "image", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L2029-L2056
10,954
fengyuanchen/viewer
dist/viewer.common.js
play
function play() { var _this2 = this; var fullscreen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (!this.isShown || this.played) { return this; } var options = this.options, player = this.player; var onLoad = this.loadImage.bind(this); var ...
javascript
function play() { var _this2 = this; var fullscreen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (!this.isShown || this.played) { return this; } var options = this.options, player = this.player; var onLoad = this.loadImage.bind(this); var ...
[ "function", "play", "(", ")", "{", "var", "_this2", "=", "this", ";", "var", "fullscreen", "=", "arguments", ".", "length", ">", "0", "&&", "arguments", "[", "0", "]", "!==", "undefined", "?", "arguments", "[", "0", "]", ":", "false", ";", "if", "(...
Play the images @param {boolean} [fullscreen=false] - Indicate if request fullscreen or not. @returns {Viewer} this
[ "Play", "the", "images" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L2064-L2128
10,955
fengyuanchen/viewer
dist/viewer.common.js
tooltip
function tooltip() { var _this6 = this; var options = this.options, tooltipBox = this.tooltipBox, imageData = this.imageData; if (!this.viewed || this.played || !options.tooltip) { return this; } tooltipBox.textContent = Math.round(imageData.ratio * 100) + '%'; if (!th...
javascript
function tooltip() { var _this6 = this; var options = this.options, tooltipBox = this.tooltipBox, imageData = this.imageData; if (!this.viewed || this.played || !options.tooltip) { return this; } tooltipBox.textContent = Math.round(imageData.ratio * 100) + '%'; if (!th...
[ "function", "tooltip", "(", ")", "{", "var", "_this6", "=", "this", ";", "var", "options", "=", "this", ".", "options", ",", "tooltipBox", "=", "this", ".", "tooltipBox", ",", "imageData", "=", "this", ".", "imageData", ";", "if", "(", "!", "this", "...
Show the current ratio of the image with percentage
[ "Show", "the", "current", "ratio", "of", "the", "image", "with", "percentage" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L2261-L2317
10,956
fengyuanchen/viewer
dist/viewer.common.js
update
function update() { var element = this.element, options = this.options, isImg = this.isImg; // Destroy viewer if the target image was deleted if (isImg && !element.parentNode) { return this.destroy(); } var images = []; forEach(isImg ? [element] : element.querySelectorA...
javascript
function update() { var element = this.element, options = this.options, isImg = this.isImg; // Destroy viewer if the target image was deleted if (isImg && !element.parentNode) { return this.destroy(); } var images = []; forEach(isImg ? [element] : element.querySelectorA...
[ "function", "update", "(", ")", "{", "var", "element", "=", "this", ".", "element", ",", "options", "=", "this", ".", "options", ",", "isImg", "=", "this", ".", "isImg", ";", "// Destroy viewer if the target image was deleted", "if", "(", "isImg", "&&", "!",...
Update viewer when images changed
[ "Update", "viewer", "when", "images", "changed" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L2344-L2422
10,957
fengyuanchen/viewer
dist/viewer.common.js
destroy
function destroy() { var element = this.element, options = this.options; if (!getData(element, NAMESPACE)) { return this; } this.destroyed = true; if (this.ready) { if (this.played) { this.stop(); } if (options.inline) { if (this.fulled) { ...
javascript
function destroy() { var element = this.element, options = this.options; if (!getData(element, NAMESPACE)) { return this; } this.destroyed = true; if (this.ready) { if (this.played) { this.stop(); } if (options.inline) { if (this.fulled) { ...
[ "function", "destroy", "(", ")", "{", "var", "element", "=", "this", ".", "element", ",", "options", "=", "this", ".", "options", ";", "if", "(", "!", "getData", "(", "element", ",", "NAMESPACE", ")", ")", "{", "return", "this", ";", "}", "this", "...
Destroy the viewer
[ "Destroy", "the", "viewer" ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L2426-L2483
10,958
fengyuanchen/viewer
dist/viewer.common.js
Viewer
function Viewer(element) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; classCallCheck(this, Viewer); if (!element || element.nodeType !== 1) { throw new Error('The first argument is required and must be an element.'); } this.element = element; th...
javascript
function Viewer(element) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; classCallCheck(this, Viewer); if (!element || element.nodeType !== 1) { throw new Error('The first argument is required and must be an element.'); } this.element = element; th...
[ "function", "Viewer", "(", "element", ")", "{", "var", "options", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "{", "}", ";", "classCallCheck", "(", "this", ","...
Create a new Viewer. @param {Element} element - The target element for viewing. @param {Object} [options={}] - The configuration options.
[ "Create", "a", "new", "Viewer", "." ]
b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd
https://github.com/fengyuanchen/viewer/blob/b6b1168eeb25812e6a39c0eba9ec6fb788f8cefd/dist/viewer.common.js#L2646-L2675
10,959
jonathantneal/flexibility
lib/read/index.js
read
function read(element) { // normalized style var style = { alignContent: 'stretch', alignItems: 'stretch', alignSelf: 'auto', borderBottomStyle: 'none', borderBottomWidth: 0, borderLeftStyle: 'none', borderLeftWidth: 0, borderRightStyle: 'none', borderRightWidth: 0, borderTopStyle: 'none', borde...
javascript
function read(element) { // normalized style var style = { alignContent: 'stretch', alignItems: 'stretch', alignSelf: 'auto', borderBottomStyle: 'none', borderBottomWidth: 0, borderLeftStyle: 'none', borderLeftWidth: 0, borderRightStyle: 'none', borderRightWidth: 0, borderTopStyle: 'none', borde...
[ "function", "read", "(", "element", ")", "{", "// normalized style", "var", "style", "=", "{", "alignContent", ":", "'stretch'", ",", "alignItems", ":", "'stretch'", ",", "alignSelf", ":", "'auto'", ",", "borderBottomStyle", ":", "'none'", ",", "borderBottomWidt...
Return flexbox related details of an element
[ "Return", "flexbox", "related", "details", "of", "an", "element" ]
c7cbaf26c39ba1c0947d16b05d95c8ac9ce022fb
https://github.com/jonathantneal/flexibility/blob/c7cbaf26c39ba1c0947d16b05d95c8ac9ce022fb/lib/read/index.js#L10-L96
10,960
ampproject/amp-by-example
templates/embed/embed.js
fitPreviewToContent
function fitPreviewToContent() { var iframeDoc = preview.contentDocument || preview.contentWindow.document; setPreviewHeight(iframeDoc.body.offsetHeight); }
javascript
function fitPreviewToContent() { var iframeDoc = preview.contentDocument || preview.contentWindow.document; setPreviewHeight(iframeDoc.body.offsetHeight); }
[ "function", "fitPreviewToContent", "(", ")", "{", "var", "iframeDoc", "=", "preview", ".", "contentDocument", "||", "preview", ".", "contentWindow", ".", "document", ";", "setPreviewHeight", "(", "iframeDoc", ".", "body", ".", "offsetHeight", ")", ";", "}" ]
Adjusts the iframe height based on the iframe's document height. The width is unchanged.
[ "Adjusts", "the", "iframe", "height", "based", "on", "the", "iframe", "s", "document", "height", ".", "The", "width", "is", "unchanged", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/templates/embed/embed.js#L35-L38
10,961
ampproject/amp-by-example
templates/embed/embed.js
postEmbedHeightToViewer
function postEmbedHeightToViewer() { var newHeight = document.getElementById('tabinterface').clientHeight; if (newHeight < MIN_IFRAME_HEIGHT) { console.log('embed height too small, reset height to 100px'); newHeight = MIN_IFRAME_HEIGHT; } // Tell the viewer about the new size window.parent.postMessage...
javascript
function postEmbedHeightToViewer() { var newHeight = document.getElementById('tabinterface').clientHeight; if (newHeight < MIN_IFRAME_HEIGHT) { console.log('embed height too small, reset height to 100px'); newHeight = MIN_IFRAME_HEIGHT; } // Tell the viewer about the new size window.parent.postMessage...
[ "function", "postEmbedHeightToViewer", "(", ")", "{", "var", "newHeight", "=", "document", ".", "getElementById", "(", "'tabinterface'", ")", ".", "clientHeight", ";", "if", "(", "newHeight", "<", "MIN_IFRAME_HEIGHT", ")", "{", "console", ".", "log", "(", "'em...
Post a message containing the document height to the amp-iframe to trigger the resize.
[ "Post", "a", "message", "containing", "the", "document", "height", "to", "the", "amp", "-", "iframe", "to", "trigger", "the", "resize", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/templates/embed/embed.js#L43-L55
10,962
ampproject/amp-by-example
static/sw.js
offlineImage
function offlineImage(name, width, height) { return `<?xml version="1.0"?> <svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" xmlns="http://www.w3.org/2000/svg" version="1.1"> <g fill="none" fill-rule="evenodd"><path fill="#F8BBD0" d="M0 0h${width}v${height}H0z"/></g> <text text-anchor=...
javascript
function offlineImage(name, width, height) { return `<?xml version="1.0"?> <svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" xmlns="http://www.w3.org/2000/svg" version="1.1"> <g fill="none" fill-rule="evenodd"><path fill="#F8BBD0" d="M0 0h${width}v${height}H0z"/></g> <text text-anchor=...
[ "function", "offlineImage", "(", "name", ",", "width", ",", "height", ")", "{", "return", "`", "${", "width", "}", "${", "height", "}", "${", "width", "}", "${", "height", "}", "${", "width", "}", "${", "height", "}", "${", "Math", ".", "floor", "(...
Generates a placeholder SVG image of the given size.
[ "Generates", "a", "placeholder", "SVG", "image", "of", "the", "given", "size", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/static/sw.js#L53-L65
10,963
ampproject/amp-by-example
static/sw.js
onMessageReceivedSubscriptionState
function onMessageReceivedSubscriptionState() { let retrievedPushSubscription = null; self.registration.pushManager.getSubscription() .then(pushSubscription => { retrievedPushSubscription = pushSubscription; if (!pushSubscription) { return null; } else...
javascript
function onMessageReceivedSubscriptionState() { let retrievedPushSubscription = null; self.registration.pushManager.getSubscription() .then(pushSubscription => { retrievedPushSubscription = pushSubscription; if (!pushSubscription) { return null; } else...
[ "function", "onMessageReceivedSubscriptionState", "(", ")", "{", "let", "retrievedPushSubscription", "=", "null", ";", "self", ".", "registration", ".", "pushManager", ".", "getSubscription", "(", ")", ".", "then", "(", "pushSubscription", "=>", "{", "retrievedPushS...
Broadcasts a single boolean describing whether the user is subscribed.
[ "Broadcasts", "a", "single", "boolean", "describing", "whether", "the", "user", "is", "subscribed", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/static/sw.js#L272-L294
10,964
ampproject/amp-by-example
static/sw.js
persistSubscriptionLocally
function persistSubscriptionLocally(subscription) { let subscriptionJSON = JSON.stringify(subscription); idb.open('web-push-db', 1).then(db => { let tx = db.transaction(['web-push-subcription'], 'readwrite'); tx.objectStore('web-push-subcription').put({ id: 1, data: subsc...
javascript
function persistSubscriptionLocally(subscription) { let subscriptionJSON = JSON.stringify(subscription); idb.open('web-push-db', 1).then(db => { let tx = db.transaction(['web-push-subcription'], 'readwrite'); tx.objectStore('web-push-subcription').put({ id: 1, data: subsc...
[ "function", "persistSubscriptionLocally", "(", "subscription", ")", "{", "let", "subscriptionJSON", "=", "JSON", ".", "stringify", "(", "subscription", ")", ";", "idb", ".", "open", "(", "'web-push-db'", ",", "1", ")", ".", "then", "(", "db", "=>", "{", "l...
Helper functions for IndexedDB management. Persists the subscription object in IndexedDB.
[ "Helper", "functions", "for", "IndexedDB", "management", ".", "Persists", "the", "subscription", "object", "in", "IndexedDB", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/static/sw.js#L358-L368
10,965
ampproject/amp-by-example
static/sw.js
urlB64ToUint8Array
function urlB64ToUint8Array(base64String) { const padding = '='.repeat((4 - base64String.length % 4) % 4); const base64 = (base64String + padding) .replace(/\-/g, '+') .replace(/_/g, '/'); const rawData = self.atob(base64); const outputArray = new Uint8Array(rawData.length); for (l...
javascript
function urlB64ToUint8Array(base64String) { const padding = '='.repeat((4 - base64String.length % 4) % 4); const base64 = (base64String + padding) .replace(/\-/g, '+') .replace(/_/g, '/'); const rawData = self.atob(base64); const outputArray = new Uint8Array(rawData.length); for (l...
[ "function", "urlB64ToUint8Array", "(", "base64String", ")", "{", "const", "padding", "=", "'='", ".", "repeat", "(", "(", "4", "-", "base64String", ".", "length", "%", "4", ")", "%", "4", ")", ";", "const", "base64", "=", "(", "base64String", "+", "pad...
Helper method to convert the VAPID key to a UInt8 array and supply it to applicationServerKey.
[ "Helper", "method", "to", "convert", "the", "VAPID", "key", "to", "a", "UInt8", "array", "and", "supply", "it", "to", "applicationServerKey", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/static/sw.js#L384-L397
10,966
ampproject/amp-by-example
lib/Preview.js
generateEmbeds
function generateEmbeds(config) { glob(config.src + '/**/*.html', {}, (err, files) => { files.forEach(file => generateEmbed(config, file)); }); }
javascript
function generateEmbeds(config) { glob(config.src + '/**/*.html', {}, (err, files) => { files.forEach(file => generateEmbed(config, file)); }); }
[ "function", "generateEmbeds", "(", "config", ")", "{", "glob", "(", "config", ".", "src", "+", "'/**/*.html'", ",", "{", "}", ",", "(", "err", ",", "files", ")", "=>", "{", "files", ".", "forEach", "(", "file", "=>", "generateEmbed", "(", "config", "...
Reads all html files in a folder and generates the embeds.
[ "Reads", "all", "html", "files", "in", "a", "folder", "and", "generates", "the", "embeds", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/lib/Preview.js#L68-L72
10,967
ampproject/amp-by-example
lib/Preview.js
generateEmbed
function generateEmbed(config, file) { const targetPath = path.join(config.destDir, path.relative(config.src, file)); const document = parseDocument(file); const sampleSections = document.sections.filter( s => s.inBody && !s.isEmptyCodeSection() ); sampleSections.forEach((section, index) => { highligh...
javascript
function generateEmbed(config, file) { const targetPath = path.join(config.destDir, path.relative(config.src, file)); const document = parseDocument(file); const sampleSections = document.sections.filter( s => s.inBody && !s.isEmptyCodeSection() ); sampleSections.forEach((section, index) => { highligh...
[ "function", "generateEmbed", "(", "config", ",", "file", ")", "{", "const", "targetPath", "=", "path", ".", "join", "(", "config", ".", "destDir", ",", "path", ".", "relative", "(", "config", ".", "src", ",", "file", ")", ")", ";", "const", "document",...
Generates embeds for a given file.
[ "Generates", "embeds", "for", "a", "given", "file", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/lib/Preview.js#L77-L103
10,968
ampproject/amp-by-example
lib/Preview.js
highlight
function highlight(code) { return new Promise((resolve, reject) => { pygmentize({ lang: 'html', format: 'html' }, code, function (err, result) { if (err) { console.log(err); reject(err); } else { resolve(result.toString()); }; }); }); }
javascript
function highlight(code) { return new Promise((resolve, reject) => { pygmentize({ lang: 'html', format: 'html' }, code, function (err, result) { if (err) { console.log(err); reject(err); } else { resolve(result.toString()); }; }); }); }
[ "function", "highlight", "(", "code", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "pygmentize", "(", "{", "lang", ":", "'html'", ",", "format", ":", "'html'", "}", ",", "code", ",", "function", "(", "err"...
Syntax highlights a string.
[ "Syntax", "highlights", "a", "string", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/lib/Preview.js#L108-L119
10,969
ampproject/amp-by-example
lib/Preview.js
generate
function generate(file, template, context, minifyResult) { let string = template.render(context, { 'styles.css': templates.styles, 'embed.js': templates.embedJs }); if (minifyResult) { string = minify(string, { caseSensitive: true, collapseWhitespace: true, html5: true, minifyC...
javascript
function generate(file, template, context, minifyResult) { let string = template.render(context, { 'styles.css': templates.styles, 'embed.js': templates.embedJs }); if (minifyResult) { string = minify(string, { caseSensitive: true, collapseWhitespace: true, html5: true, minifyC...
[ "function", "generate", "(", "file", ",", "template", ",", "context", ",", "minifyResult", ")", "{", "let", "string", "=", "template", ".", "render", "(", "context", ",", "{", "'styles.css'", ":", "templates", ".", "styles", ",", "'embed.js'", ":", "templa...
Renders the given template into a file.
[ "Renders", "the", "given", "template", "into", "a", "file", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/lib/Preview.js#L124-L141
10,970
ampproject/amp-by-example
lib/Preview.js
addFlag
function addFlag() { const filename = arguments[0]; const postfix = [].slice.call(arguments, 1).join('.'); return filename.replace('.html', '.' + postfix + '.html'); }
javascript
function addFlag() { const filename = arguments[0]; const postfix = [].slice.call(arguments, 1).join('.'); return filename.replace('.html', '.' + postfix + '.html'); }
[ "function", "addFlag", "(", ")", "{", "const", "filename", "=", "arguments", "[", "0", "]", ";", "const", "postfix", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", ".", "join", "(", "'.'", ")", ";", "return", "filename",...
Appends a list of flags separated by a '.' to a filename.
[ "Appends", "a", "list", "of", "flags", "separated", "by", "a", ".", "to", "a", "filename", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/lib/Preview.js#L146-L150
10,971
ampproject/amp-by-example
lib/Preview.js
generateTemplate
function generateTemplate(context) { let _page; let _phantom; phantom.create([], { logLevel: 'error' }).then(function (ph) { _phantom = ph; ph.createPage() .then(page => { _page = page; const url = path.join(context.config.destRoot, context.sample.embed); return _page.propert...
javascript
function generateTemplate(context) { let _page; let _phantom; phantom.create([], { logLevel: 'error' }).then(function (ph) { _phantom = ph; ph.createPage() .then(page => { _page = page; const url = path.join(context.config.destRoot, context.sample.embed); return _page.propert...
[ "function", "generateTemplate", "(", "context", ")", "{", "let", "_page", ";", "let", "_phantom", ";", "phantom", ".", "create", "(", "[", "]", ",", "{", "logLevel", ":", "'error'", "}", ")", ".", "then", "(", "function", "(", "ph", ")", "{", "_phant...
Opens the embed html file in a browser to determine the initial height.
[ "Opens", "the", "embed", "html", "file", "in", "a", "browser", "to", "determine", "the", "initial", "height", "." ]
76267b11e3a8888c872ce4f306afdcdec959d5c1
https://github.com/ampproject/amp-by-example/blob/76267b11e3a8888c872ce4f306afdcdec959d5c1/lib/Preview.js#L163-L192
10,972
mscdex/busboy
deps/encoding/encoding.js
UTF8Decoder
function UTF8Decoder(options) { var fatal = options.fatal; var /** @type {number} */ utf8_code_point = 0, /** @type {number} */ utf8_bytes_needed = 0, /** @type {number} */ utf8_bytes_seen = 0, /** @type {number} */ utf8_lower_boundary = 0; /** * @param {ByteInputStream} byte_pointer The byt...
javascript
function UTF8Decoder(options) { var fatal = options.fatal; var /** @type {number} */ utf8_code_point = 0, /** @type {number} */ utf8_bytes_needed = 0, /** @type {number} */ utf8_bytes_seen = 0, /** @type {number} */ utf8_lower_boundary = 0; /** * @param {ByteInputStream} byte_pointer The byt...
[ "function", "UTF8Decoder", "(", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {number} */", "utf8_code_point", "=", "0", ",", "/** @type {number} */", "utf8_bytes_needed", "=", "0", ",", "/** @type {number} */", "utf8_byte...
8.1 utf-8 @constructor @param {{fatal: boolean}} options
[ "8", ".", "1", "utf", "-", "8" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L1026-L1096
10,973
mscdex/busboy
deps/encoding/encoding.js
GBKDecoder
function GBKDecoder(gb18030, options) { var fatal = options.fatal; var /** @type {number} */ gbk_first = 0x00, /** @type {number} */ gbk_second = 0x00, /** @type {number} */ gbk_third = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code...
javascript
function GBKDecoder(gb18030, options) { var fatal = options.fatal; var /** @type {number} */ gbk_first = 0x00, /** @type {number} */ gbk_second = 0x00, /** @type {number} */ gbk_third = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code...
[ "function", "GBKDecoder", "(", "gb18030", ",", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {number} */", "gbk_first", "=", "0x00", ",", "/** @type {number} */", "gbk_second", "=", "0x00", ",", "/** @type {number} */", ...
9.1 gbk @constructor @param {boolean} gb18030 True if decoding gb18030, false otherwise. @param {{fatal: boolean}} options
[ "9", ".", "1", "gbk" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L1244-L1329
10,974
mscdex/busboy
deps/encoding/encoding.js
HZGB2312Decoder
function HZGB2312Decoder(options) { var fatal = options.fatal; var /** @type {boolean} */ hzgb2312 = false, /** @type {number} */ hzgb2312_lead = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * ...
javascript
function HZGB2312Decoder(options) { var fatal = options.fatal; var /** @type {boolean} */ hzgb2312 = false, /** @type {number} */ hzgb2312_lead = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * ...
[ "function", "HZGB2312Decoder", "(", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {boolean} */", "hzgb2312", "=", "false", ",", "/** @type {number} */", "hzgb2312_lead", "=", "0x00", ";", "/**\n * @param {ByteInputStream} ...
10.2 hz-gb-2312 @constructor @param {{fatal: boolean}} options
[ "10", ".", "2", "hz", "-", "gb", "-", "2312" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L1397-L1470
10,975
mscdex/busboy
deps/encoding/encoding.js
Big5Decoder
function Big5Decoder(options) { var fatal = options.fatal; var /** @type {number} */ big5_lead = 0x00, /** @type {?number} */ big5_pending = null; /** * @param {ByteInputStream} byte_pointer The byte steram to decode. * @return {?number} The next code point decoded, or null if not enough * dat...
javascript
function Big5Decoder(options) { var fatal = options.fatal; var /** @type {number} */ big5_lead = 0x00, /** @type {?number} */ big5_pending = null; /** * @param {ByteInputStream} byte_pointer The byte steram to decode. * @return {?number} The next code point decoded, or null if not enough * dat...
[ "function", "Big5Decoder", "(", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {number} */", "big5_lead", "=", "0x00", ",", "/** @type {?number} */", "big5_pending", "=", "null", ";", "/**\n * @param {ByteInputStream} byte_...
11.1 big5 @constructor @param {{fatal: boolean}} options
[ "11", ".", "1", "big5" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L1539-L1608
10,976
mscdex/busboy
deps/encoding/encoding.js
EUCJPDecoder
function EUCJPDecoder(options) { var fatal = options.fatal; var /** @type {number} */ eucjp_first = 0x00, /** @type {number} */ eucjp_second = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * da...
javascript
function EUCJPDecoder(options) { var fatal = options.fatal; var /** @type {number} */ eucjp_first = 0x00, /** @type {number} */ eucjp_second = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * da...
[ "function", "EUCJPDecoder", "(", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {number} */", "eucjp_first", "=", "0x00", ",", "/** @type {number} */", "eucjp_second", "=", "0x00", ";", "/**\n * @param {ByteInputStream} byt...
12.1 euc.jp @constructor @param {{fatal: boolean}} options
[ "12", ".", "1", "euc", ".", "jp" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L1664-L1736
10,977
mscdex/busboy
deps/encoding/encoding.js
ShiftJISDecoder
function ShiftJISDecoder(options) { var fatal = options.fatal; var /** @type {number} */ shiftjis_lead = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * data exists in the input stream to decode a co...
javascript
function ShiftJISDecoder(options) { var fatal = options.fatal; var /** @type {number} */ shiftjis_lead = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * data exists in the input stream to decode a co...
[ "function", "ShiftJISDecoder", "(", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {number} */", "shiftjis_lead", "=", "0x00", ";", "/**\n * @param {ByteInputStream} byte_pointer The byte stream to decode.\n * @return {?number} The...
12.3 shift_jis @constructor @param {{fatal: boolean}} options
[ "12", ".", "3", "shift_jis" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L2016-L2062
10,978
mscdex/busboy
deps/encoding/encoding.js
EUCKRDecoder
function EUCKRDecoder(options) { var fatal = options.fatal; var /** @type {number} */ euckr_lead = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * data exists in the input stream to decode a complete...
javascript
function EUCKRDecoder(options) { var fatal = options.fatal; var /** @type {number} */ euckr_lead = 0x00; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null if not enough * data exists in the input stream to decode a complete...
[ "function", "EUCKRDecoder", "(", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {number} */", "euckr_lead", "=", "0x00", ";", "/**\n * @param {ByteInputStream} byte_pointer The byte stream to decode.\n * @return {?number} The next ...
13.1 euc-kr @constructor @param {{fatal: boolean}} options
[ "13", ".", "1", "euc", "-", "kr" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L2124-L2185
10,979
mscdex/busboy
deps/encoding/encoding.js
UTF16Decoder
function UTF16Decoder(utf16_be, options) { var fatal = options.fatal; var /** @type {?number} */ utf16_lead_byte = null, /** @type {?number} */ utf16_lead_surrogate = null; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null i...
javascript
function UTF16Decoder(utf16_be, options) { var fatal = options.fatal; var /** @type {?number} */ utf16_lead_byte = null, /** @type {?number} */ utf16_lead_surrogate = null; /** * @param {ByteInputStream} byte_pointer The byte stream to decode. * @return {?number} The next code point decoded, or null i...
[ "function", "UTF16Decoder", "(", "utf16_be", ",", "options", ")", "{", "var", "fatal", "=", "options", ".", "fatal", ";", "var", "/** @type {?number} */", "utf16_lead_byte", "=", "null", ",", "/** @type {?number} */", "utf16_lead_surrogate", "=", "null", ";", "/**...
14.2 utf-16 @constructor @param {boolean} utf16_be True if big-endian, false if little-endian. @param {{fatal: boolean}} options
[ "14", ".", "2", "utf", "-", "16" ]
da0e67d503cc39727dfa3a85c142d19de6f2c8c7
https://github.com/mscdex/busboy/blob/da0e67d503cc39727dfa3a85c142d19de6f2c8c7/deps/encoding/encoding.js#L2250-L2300
10,980
angular-translate/angular-translate
Gruntfile.js
function () { var scopes = fs.readdirSync('./test_scopes').filter(function (filename) { return filename[0] !== '.'; }); var config = { options: { color: false, interactive: false } }; // Create a sub config for each test scope for (var idx in scopes) { var...
javascript
function () { var scopes = fs.readdirSync('./test_scopes').filter(function (filename) { return filename[0] !== '.'; }); var config = { options: { color: false, interactive: false } }; // Create a sub config for each test scope for (var idx in scopes) { var...
[ "function", "(", ")", "{", "var", "scopes", "=", "fs", ".", "readdirSync", "(", "'./test_scopes'", ")", ".", "filter", "(", "function", "(", "filename", ")", "{", "return", "filename", "[", "0", "]", "!==", "'.'", ";", "}", ")", ";", "var", "config",...
Returns configuration for bower-install plugin
[ "Returns", "configuration", "for", "bower", "-", "install", "plugin" ]
eda9f29b3343d84f43f9fa30a39a1ae636d1c494
https://github.com/angular-translate/angular-translate/blob/eda9f29b3343d84f43f9fa30a39a1ae636d1c494/Gruntfile.js#L12-L33
10,981
angular-translate/angular-translate
src/directive/translate-attr.js
function () { angular.forEach(translateAttr, function (translationId, attributeName) { if (!translationId) { return; } previousAttributes[attributeName] = true; // if translation id starts with '.' and translateNamespace given, prepend namespace if ...
javascript
function () { angular.forEach(translateAttr, function (translationId, attributeName) { if (!translationId) { return; } previousAttributes[attributeName] = true; // if translation id starts with '.' and translateNamespace given, prepend namespace if ...
[ "function", "(", ")", "{", "angular", ".", "forEach", "(", "translateAttr", ",", "function", "(", "translationId", ",", "attributeName", ")", "{", "if", "(", "!", "translationId", ")", "{", "return", ";", "}", "previousAttributes", "[", "attributeName", "]",...
Main update translations function
[ "Main", "update", "translations", "function" ]
eda9f29b3343d84f43f9fa30a39a1ae636d1c494
https://github.com/angular-translate/angular-translate/blob/eda9f29b3343d84f43f9fa30a39a1ae636d1c494/src/directive/translate-attr.js#L75-L101
10,982
angular-translate/angular-translate
src/service/loader-partial.js
function () { return $http( angular.extend({ method : 'GET', url : self.parseUrl(self.urlTemplate || urlTemplate, lang) }, $httpOptions) ); }
javascript
function () { return $http( angular.extend({ method : 'GET', url : self.parseUrl(self.urlTemplate || urlTemplate, lang) }, $httpOptions) ); }
[ "function", "(", ")", "{", "return", "$http", "(", "angular", ".", "extend", "(", "{", "method", ":", "'GET'", ",", "url", ":", "self", ".", "parseUrl", "(", "self", ".", "urlTemplate", "||", "urlTemplate", ",", "lang", ")", "}", ",", "$httpOptions", ...
private helper helpers
[ "private", "helper", "helpers" ]
eda9f29b3343d84f43f9fa30a39a1ae636d1c494
https://github.com/angular-translate/angular-translate/blob/eda9f29b3343d84f43f9fa30a39a1ae636d1c494/src/service/loader-partial.js#L63-L71
10,983
dceejay/RedMap
worldmap/worldmap.js
function() { ws = new SockJS(location.pathname.split("index")[0] + 'socket'); ws.onopen = function() { console.log("CONNECTED"); if (!inIframe) { document.getElementById("footer").innerHTML = "<font color='#494'>"+ibmfoot+"</font>"; } ws.send(JSON.stringify({action:"c...
javascript
function() { ws = new SockJS(location.pathname.split("index")[0] + 'socket'); ws.onopen = function() { console.log("CONNECTED"); if (!inIframe) { document.getElementById("footer").innerHTML = "<font color='#494'>"+ibmfoot+"</font>"; } ws.send(JSON.stringify({action:"c...
[ "function", "(", ")", "{", "ws", "=", "new", "SockJS", "(", "location", ".", "pathname", ".", "split", "(", "\"index\"", ")", "[", "0", "]", "+", "'socket'", ")", ";", "ws", ".", "onopen", "=", "function", "(", ")", "{", "console", ".", "log", "(...
Create the socket
[ "Create", "the", "socket" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L47-L92
10,984
dceejay/RedMap
worldmap/worldmap.js
doTidyUp
function doTidyUp(l) { var d = parseInt(Date.now()/1000); for (var m in markers) { if ((l && (l == markers[m].lay)) || typeof markers[m].ts != "undefined") { if ((l && (l == markers[m].lay)) || (markers[m].hasOwnProperty("ts") && (Number(markers[m].ts) < d) && (markers[m].lay !== "_drawing")...
javascript
function doTidyUp(l) { var d = parseInt(Date.now()/1000); for (var m in markers) { if ((l && (l == markers[m].lay)) || typeof markers[m].ts != "undefined") { if ((l && (l == markers[m].lay)) || (markers[m].hasOwnProperty("ts") && (Number(markers[m].ts) < d) && (markers[m].lay !== "_drawing")...
[ "function", "doTidyUp", "(", "l", ")", "{", "var", "d", "=", "parseInt", "(", "Date", ".", "now", "(", ")", "/", "1000", ")", ";", "for", "(", "var", "m", "in", "markers", ")", "{", "if", "(", "(", "l", "&&", "(", "l", "==", "markers", "[", ...
Remove old markers
[ "Remove", "old", "markers" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L253-L276
10,985
dceejay/RedMap
worldmap/worldmap.js
doSearch
function doSearch() { var value = document.getElementById('search').value; marks = []; marksIndex = 0; for (var key in markers) { if ( (~(key.toLowerCase()).indexOf(value.toLowerCase())) && (mb.contains(markers[key].getLatLng()))) { marks.push(markers[key]); } if (mar...
javascript
function doSearch() { var value = document.getElementById('search').value; marks = []; marksIndex = 0; for (var key in markers) { if ( (~(key.toLowerCase()).indexOf(value.toLowerCase())) && (mb.contains(markers[key].getLatLng()))) { marks.push(markers[key]); } if (mar...
[ "function", "doSearch", "(", ")", "{", "var", "value", "=", "document", ".", "getElementById", "(", "'search'", ")", ".", "value", ";", "marks", "=", "[", "]", ";", "marksIndex", "=", "0", ";", "for", "(", "var", "key", "in", "markers", ")", "{", "...
Search for markers with names of ... or icons of ...
[ "Search", "for", "markers", "with", "names", "of", "...", "or", "icons", "of", "..." ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L306-L350
10,986
dceejay/RedMap
worldmap/worldmap.js
moveToMarks
function moveToMarks() { if (marks.length > marksIndex) { var m = marks[marksIndex]; map.setView(m.getLatLng(), map.getZoom()); m.openPopup(); marksIndex++; setTimeout(moveToMarks, 2500); } }
javascript
function moveToMarks() { if (marks.length > marksIndex) { var m = marks[marksIndex]; map.setView(m.getLatLng(), map.getZoom()); m.openPopup(); marksIndex++; setTimeout(moveToMarks, 2500); } }
[ "function", "moveToMarks", "(", ")", "{", "if", "(", "marks", ".", "length", ">", "marksIndex", ")", "{", "var", "m", "=", "marks", "[", "marksIndex", "]", ";", "map", ".", "setView", "(", "m", ".", "getLatLng", "(", ")", ",", "map", ".", "getZoom"...
Jump to a markers position - centralise it on map
[ "Jump", "to", "a", "markers", "position", "-", "centralise", "it", "on", "map" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L353-L361
10,987
dceejay/RedMap
worldmap/worldmap.js
clearSearch
function clearSearch() { var value = document.getElementById('search').value; marks = []; marksIndex = 0; for (var key in markers) { if ( (~(key.toLowerCase()).indexOf(value.toLowerCase())) && (mb.contains(markers[key].getLatLng()))) { marks.push(markers[key]); } } re...
javascript
function clearSearch() { var value = document.getElementById('search').value; marks = []; marksIndex = 0; for (var key in markers) { if ( (~(key.toLowerCase()).indexOf(value.toLowerCase())) && (mb.contains(markers[key].getLatLng()))) { marks.push(markers[key]); } } re...
[ "function", "clearSearch", "(", ")", "{", "var", "value", "=", "document", ".", "getElementById", "(", "'search'", ")", ".", "value", ";", "marks", "=", "[", "]", ";", "marksIndex", "=", "0", ";", "for", "(", "var", "key", "in", "markers", ")", "{", ...
Clear Search With Marker names
[ "Clear", "Search", "With", "Marker", "names" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L364-L380
10,988
dceejay/RedMap
worldmap/worldmap.js
setMarker
function setMarker(data) { var rightmenu = function(m) { // customise right click context menu var rightcontext = ""; if (polygons[data.name] == undefined) { rightcontext = "<button id='delbutton' onclick='delMarker(\""+data.name+"\",true);'>Delete</button>"; } e...
javascript
function setMarker(data) { var rightmenu = function(m) { // customise right click context menu var rightcontext = ""; if (polygons[data.name] == undefined) { rightcontext = "<button id='delbutton' onclick='delMarker(\""+data.name+"\",true);'>Delete</button>"; } e...
[ "function", "setMarker", "(", "data", ")", "{", "var", "rightmenu", "=", "function", "(", "m", ")", "{", "// customise right click context menu", "var", "rightcontext", "=", "\"\"", ";", "if", "(", "polygons", "[", "data", ".", "name", "]", "==", "undefined"...
the MAIN add something to map function
[ "the", "MAIN", "add", "something", "to", "map", "function" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L883-L1455
10,989
dceejay/RedMap
worldmap/worldmap.js
doGeojson
function doGeojson(g) { console.log("GEOJSON",g); if (!basemaps["geojson"]) { var opt = { style: function(feature) { var st = { stroke:true, color:"#910000", weight:2, fill:true, fillColor:"#910000", fillOpacity:0.3 }; if (feature.hasOwnProperty("properties")) { ...
javascript
function doGeojson(g) { console.log("GEOJSON",g); if (!basemaps["geojson"]) { var opt = { style: function(feature) { var st = { stroke:true, color:"#910000", weight:2, fill:true, fillColor:"#910000", fillOpacity:0.3 }; if (feature.hasOwnProperty("properties")) { ...
[ "function", "doGeojson", "(", "g", ")", "{", "console", ".", "log", "(", "\"GEOJSON\"", ",", "g", ")", ";", "if", "(", "!", "basemaps", "[", "\"geojson\"", "]", ")", "{", "var", "opt", "=", "{", "style", ":", "function", "(", "feature", ")", "{", ...
handle any incoming GEOJSON directly - may style badly
[ "handle", "any", "incoming", "GEOJSON", "directly", "-", "may", "style", "badly" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/worldmap.js#L1868-L1889
10,990
dceejay/RedMap
worldmap/leaflet/easy-button.js
function(newState){ // when called with no args, it's a getter if (arguments.length === 0) { return this._currentState.stateName; } // activate by name if(typeof newState == 'string'){ this._activateStateNamed(newState); // activate by index } else if (typeof newState == 'num...
javascript
function(newState){ // when called with no args, it's a getter if (arguments.length === 0) { return this._currentState.stateName; } // activate by name if(typeof newState == 'string'){ this._activateStateNamed(newState); // activate by index } else if (typeof newState == 'num...
[ "function", "(", "newState", ")", "{", "// when called with no args, it's a getter", "if", "(", "arguments", ".", "length", "===", "0", ")", "{", "return", "this", ".", "_currentState", ".", "stateName", ";", "}", "// activate by name", "if", "(", "typeof", "new...
populated on init
[ "populated", "on", "init" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/leaflet/easy-button.js#L219-L238
10,991
dceejay/RedMap
worldmap/leaflet/easy-button.js
State
function State(template, easyButton){ this.title = template.title; this.stateName = template.stateName ? template.stateName : 'unnamed-state'; // build the wrapper this.icon = L.DomUtil.create('span', ''); L.DomUtil.addClass(this.icon, 'button-state state-' + this.stateName.replace(/(^\s*|\s*$)/g,'')); t...
javascript
function State(template, easyButton){ this.title = template.title; this.stateName = template.stateName ? template.stateName : 'unnamed-state'; // build the wrapper this.icon = L.DomUtil.create('span', ''); L.DomUtil.addClass(this.icon, 'button-state state-' + this.stateName.replace(/(^\s*|\s*$)/g,'')); t...
[ "function", "State", "(", "template", ",", "easyButton", ")", "{", "this", ".", "title", "=", "template", ".", "title", ";", "this", ".", "stateName", "=", "template", ".", "stateName", "?", "template", ".", "stateName", ":", "'unnamed-state'", ";", "// bu...
constructor for states so only curated states end up getting called
[ "constructor", "for", "states", "so", "only", "curated", "states", "end", "up", "getting", "called" ]
94aa812ed2c63d02205c29e3e367815229f441f6
https://github.com/dceejay/RedMap/blob/94aa812ed2c63d02205c29e3e367815229f441f6/worldmap/leaflet/easy-button.js#L331-L342
10,992
webpack-contrib/sass-loader
lib/webpackImporter.js
webpackImporter
function webpackImporter(resourcePath, resolve, addNormalizedDependency) { function dirContextFrom(fileContext) { return path.dirname( // The first file is 'stdin' when we're using the data option fileContext === 'stdin' ? resourcePath : fileContext ); } // eslint-disable-next-line no-shadow ...
javascript
function webpackImporter(resourcePath, resolve, addNormalizedDependency) { function dirContextFrom(fileContext) { return path.dirname( // The first file is 'stdin' when we're using the data option fileContext === 'stdin' ? resourcePath : fileContext ); } // eslint-disable-next-line no-shadow ...
[ "function", "webpackImporter", "(", "resourcePath", ",", "resolve", ",", "addNormalizedDependency", ")", "{", "function", "dirContextFrom", "(", "fileContext", ")", "{", "return", "path", ".", "dirname", "(", "// The first file is 'stdin' when we're using the data option", ...
Returns an importer that uses webpack's resolving algorithm. It's important that the returned function has the correct number of arguments (based on whether the call is sync or async) because otherwise node-sass doesn't exit. @param {string} resourcePath @param {PromisedResolve} resolve @param {Function<string>} addN...
[ "Returns", "an", "importer", "that", "uses", "webpack", "s", "resolving", "algorithm", "." ]
e279f2a129eee0bd0b624b5acd498f23a81ee35e
https://github.com/webpack-contrib/sass-loader/blob/e279f2a129eee0bd0b624b5acd498f23a81ee35e/lib/webpackImporter.js#L38-L74
10,993
webpack-contrib/sass-loader
lib/proxyCustomImporters.js
proxyCustomImporters
function proxyCustomImporters(importer, resourcePath) { return [].concat(importer).map( // eslint-disable-next-line no-shadow (importer) => function customImporter() { return importer.apply( this, // eslint-disable-next-line prefer-rest-params Array.from(arguments)....
javascript
function proxyCustomImporters(importer, resourcePath) { return [].concat(importer).map( // eslint-disable-next-line no-shadow (importer) => function customImporter() { return importer.apply( this, // eslint-disable-next-line prefer-rest-params Array.from(arguments)....
[ "function", "proxyCustomImporters", "(", "importer", ",", "resourcePath", ")", "{", "return", "[", "]", ".", "concat", "(", "importer", ")", ".", "map", "(", "// eslint-disable-next-line no-shadow", "(", "importer", ")", "=>", "function", "customImporter", "(", ...
Creates new custom importers that use the given `resourcePath` if libsass calls the custom importer with `prev` being 'stdin'. Why do we need this? We have to use the `data` option of node-sass in order to compile our sass because the `resourcePath` might not be an actual file on disk. When using the `data` option, li...
[ "Creates", "new", "custom", "importers", "that", "use", "the", "given", "resourcePath", "if", "libsass", "calls", "the", "custom", "importer", "with", "prev", "being", "stdin", "." ]
e279f2a129eee0bd0b624b5acd498f23a81ee35e
https://github.com/webpack-contrib/sass-loader/blob/e279f2a129eee0bd0b624b5acd498f23a81ee35e/lib/proxyCustomImporters.js#L17-L31
10,994
webpack-contrib/sass-loader
lib/normalizeOptions.js
normalizeOptions
function normalizeOptions(loaderContext, content, webpackImporter) { const options = cloneDeep(utils.getOptions(loaderContext)) || {}; const { resourcePath } = loaderContext; // allow opt.functions to be configured WRT loaderContext if (typeof options.functions === 'function') { options.functions = options...
javascript
function normalizeOptions(loaderContext, content, webpackImporter) { const options = cloneDeep(utils.getOptions(loaderContext)) || {}; const { resourcePath } = loaderContext; // allow opt.functions to be configured WRT loaderContext if (typeof options.functions === 'function') { options.functions = options...
[ "function", "normalizeOptions", "(", "loaderContext", ",", "content", ",", "webpackImporter", ")", "{", "const", "options", "=", "cloneDeep", "(", "utils", ".", "getOptions", "(", "loaderContext", ")", ")", "||", "{", "}", ";", "const", "{", "resourcePath", ...
Derives the sass options from the loader context and normalizes its values with sane defaults. Please note: If loaderContext.query is an options object, it will be re-used across multiple invocations. That's why we must not modify the object directly. @param {LoaderContext} loaderContext @param {string} content @para...
[ "Derives", "the", "sass", "options", "from", "the", "loader", "context", "and", "normalizes", "its", "values", "with", "sane", "defaults", "." ]
e279f2a129eee0bd0b624b5acd498f23a81ee35e
https://github.com/webpack-contrib/sass-loader/blob/e279f2a129eee0bd0b624b5acd498f23a81ee35e/lib/normalizeOptions.js#L22-L95
10,995
webpack-contrib/sass-loader
lib/importsToResolve.js
importsToResolve
function importsToResolve(url) { const request = utils.urlToRequest(url); // Keep in mind: ext can also be something like '.datepicker' when the true extension is omitted and the filename contains a dot. // @see https://github.com/webpack-contrib/sass-loader/issues/167 const ext = path.extname(request); if (...
javascript
function importsToResolve(url) { const request = utils.urlToRequest(url); // Keep in mind: ext can also be something like '.datepicker' when the true extension is omitted and the filename contains a dot. // @see https://github.com/webpack-contrib/sass-loader/issues/167 const ext = path.extname(request); if (...
[ "function", "importsToResolve", "(", "url", ")", "{", "const", "request", "=", "utils", ".", "urlToRequest", "(", "url", ")", ";", "// Keep in mind: ext can also be something like '.datepicker' when the true extension is omitted and the filename contains a dot.", "// @see https://g...
When libsass tries to resolve an import, it uses a special algorithm. Since the sass-loader uses webpack to resolve the modules, we need to simulate that algorithm. This function returns an array of import paths to try. The last entry in the array is always the original url to enable straight-forward webpack.config ali...
[ "When", "libsass", "tries", "to", "resolve", "an", "import", "it", "uses", "a", "special", "algorithm", ".", "Since", "the", "sass", "-", "loader", "uses", "webpack", "to", "resolve", "the", "modules", "we", "need", "to", "simulate", "that", "algorithm", "...
e279f2a129eee0bd0b624b5acd498f23a81ee35e
https://github.com/webpack-contrib/sass-loader/blob/e279f2a129eee0bd0b624b5acd498f23a81ee35e/lib/importsToResolve.js#L18-L60
10,996
webpack-contrib/sass-loader
lib/loader.js
sassLoader
function sassLoader(content) { const callback = this.async(); const isSync = typeof callback !== 'function'; const self = this; const { resourcePath } = this; function addNormalizedDependency(file) { // node-sass returns POSIX paths self.dependency(path.normalize(file)); } if (isSync) { thro...
javascript
function sassLoader(content) { const callback = this.async(); const isSync = typeof callback !== 'function'; const self = this; const { resourcePath } = this; function addNormalizedDependency(file) { // node-sass returns POSIX paths self.dependency(path.normalize(file)); } if (isSync) { thro...
[ "function", "sassLoader", "(", "content", ")", "{", "const", "callback", "=", "this", ".", "async", "(", ")", ";", "const", "isSync", "=", "typeof", "callback", "!==", "'function'", ";", "const", "self", "=", "this", ";", "const", "{", "resourcePath", "}...
The sass-loader makes node-sass and dart-sass available to webpack modules. @this {LoaderContext} @param {string} content
[ "The", "sass", "-", "loader", "makes", "node", "-", "sass", "and", "dart", "-", "sass", "available", "to", "webpack", "modules", "." ]
e279f2a129eee0bd0b624b5acd498f23a81ee35e
https://github.com/webpack-contrib/sass-loader/blob/e279f2a129eee0bd0b624b5acd498f23a81ee35e/lib/loader.js#L21-L115
10,997
webpack-contrib/sass-loader
lib/loader.js
getRenderFuncFromSassImpl
function getRenderFuncFromSassImpl(module) { const { info } = module; const components = info.split('\t'); if (components.length < 2) { throw new Error(`Unknown Sass implementation "${info}".`); } const [implementation, version] = components; if (!semver.valid(version)) { throw new Error(`Invalid...
javascript
function getRenderFuncFromSassImpl(module) { const { info } = module; const components = info.split('\t'); if (components.length < 2) { throw new Error(`Unknown Sass implementation "${info}".`); } const [implementation, version] = components; if (!semver.valid(version)) { throw new Error(`Invalid...
[ "function", "getRenderFuncFromSassImpl", "(", "module", ")", "{", "const", "{", "info", "}", "=", "module", ";", "const", "components", "=", "info", ".", "split", "(", "'\\t'", ")", ";", "if", "(", "components", ".", "length", "<", "2", ")", "{", "thro...
Verifies that the implementation and version of Sass is supported by this loader. @param {Object} module @returns {Function}
[ "Verifies", "that", "the", "implementation", "and", "version", "of", "Sass", "is", "supported", "by", "this", "loader", "." ]
e279f2a129eee0bd0b624b5acd498f23a81ee35e
https://github.com/webpack-contrib/sass-loader/blob/e279f2a129eee0bd0b624b5acd498f23a81ee35e/lib/loader.js#L123-L168
10,998
node-apn/node-apn
lib/token.js
token
function token(input) { let token; if (typeof input === "string") { token = input; } else if (Buffer.isBuffer(input)) { token = input.toString("hex"); } token = token.replace(/[^0-9a-f]/gi, ""); if (token.length === 0) { throw new Error("Token has invalid length"); } return token; }
javascript
function token(input) { let token; if (typeof input === "string") { token = input; } else if (Buffer.isBuffer(input)) { token = input.toString("hex"); } token = token.replace(/[^0-9a-f]/gi, ""); if (token.length === 0) { throw new Error("Token has invalid length"); } return token; }
[ "function", "token", "(", "input", ")", "{", "let", "token", ";", "if", "(", "typeof", "input", "===", "\"string\"", ")", "{", "token", "=", "input", ";", "}", "else", "if", "(", "Buffer", ".", "isBuffer", "(", "input", ")", ")", "{", "token", "=",...
Validates a device token Will convert to string and removes invalid characters as required.
[ "Validates", "a", "device", "token" ]
e72259fae1a749ce0a7bc146d7ea89dcd9593fca
https://github.com/node-apn/node-apn/blob/e72259fae1a749ce0a7bc146d7ea89dcd9593fca/lib/token.js#L7-L23
10,999
node-apn/node-apn
lib/notification/index.js
Notification
function Notification (payload) { this.encoding = "utf8"; this.payload = {}; this.compiled = false; this.aps = {}; this.expiry = 0; this.priority = 10; if (payload) { for(let key in payload) { if (payload.hasOwnProperty(key)) { this[key] = payload[key]; } } } }
javascript
function Notification (payload) { this.encoding = "utf8"; this.payload = {}; this.compiled = false; this.aps = {}; this.expiry = 0; this.priority = 10; if (payload) { for(let key in payload) { if (payload.hasOwnProperty(key)) { this[key] = payload[key]; } } } }
[ "function", "Notification", "(", "payload", ")", "{", "this", ".", "encoding", "=", "\"utf8\"", ";", "this", ".", "payload", "=", "{", "}", ";", "this", ".", "compiled", "=", "false", ";", "this", ".", "aps", "=", "{", "}", ";", "this", ".", "expir...
Create a notification @constructor
[ "Create", "a", "notification" ]
e72259fae1a749ce0a7bc146d7ea89dcd9593fca
https://github.com/node-apn/node-apn/blob/e72259fae1a749ce0a7bc146d7ea89dcd9593fca/lib/notification/index.js#L6-L22