How to use the comment-regex function in comment-regex

To help you get started, we’ve selected a few comment-regex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AlexVestin / musicvid.org / src / editor / animation / util / ShaderToyMaterial.js View on Github external
static retriveUsedUniforms(shaderToySample) {
        /*
        uniform vec3 iResolution; //Done: viewport resolution (in pixels)
        uniform float iTime; //Done: shader playback time (in seconds)
        uniform float iTimeDelta; //Done: render time (in seconds)
        uniform int iFrame; //Done: shader playback frame
        uniform float iChannelTime[4]; //Wont Do now: channel playback time (in seconds)
        uniform vec3 iChannelResolution[4]; // channel resolution (in pixels)
        uniform vec4 iMouse; // mouse pixel coords. xy: current (if MLB down), zw: click
        uniform samplerXX iChannel0..3; // input channel. XX = 2D/Cube
        uniform vec4 iDate; //Do (year, month, day, time in seconds)
        uniform float iSampleRate; //Wont Do sound sample rate (i.e., 44100)
        
        */
        let commentLessShader = shaderToySample.replace(commentRegex(), "");
        let expectedUniforms = "iTime,iTimeDelta,iResolution,iFrame,iChannelTime[4],iChannelResolution,iChannel0,iChannel1,iChannel2,iChannel3,iDate,iMouse".split(",");
        let existingUniforms = {};
        expectedUniforms.forEach(uniform => {
            if (commentLessShader.includes(uniform))
                existingUniforms[uniform] = true;
        });

        return existingUniforms;
    }
github Shakthi / three-shadertoy-material / src / ShaderToyMaterial.js View on Github external
static retriveUsedUniforms(shaderToySample) {
        /*
        uniform vec3 iResolution; //Done: viewport resolution (in pixels)
        uniform float iTime; //Done: shader playback time (in seconds)
        uniform float iTimeDelta; //Done: render time (in seconds)
        uniform int iFrame; //Done: shader playback frame

        uniform float iChannelTime[4]; //Wont Do now: channel playback time (in seconds)
        uniform vec3 iChannelResolution[4]; // channel resolution (in pixels)
        uniform vec4 iMouse; // mouse pixel coords. xy: current (if MLB down), zw: click
        uniform samplerXX iChannel0..3; // input channel. XX = 2D/Cube
        uniform vec4 iDate; //Do (year, month, day, time in seconds)
        uniform float iSampleRate; //Wont Do sound sample rate (i.e., 44100)
        
        */
        let commentLessShader = shaderToySample.replace(commentRegex(), "");
        let expectedUniforms = "iTime,iTimeDelta,iResolution,iFrame,iChannelTime[4],iChannelResolution,iChannel0,iChannel1,iChannel2,iChannel3,iDate,iMouse".split(",");
        let existingUniforms = {};
        expectedUniforms.forEach(uniform => {
            if (commentLessShader.includes(uniform))
                existingUniforms[uniform] = true;
        });

        return existingUniforms;
    }
github egoist / hanabi / src / index.js View on Github external
export default function (input, {
  colors = defaultColors
} = {}) {
  let index = 0
  const cache = {}
  const wordRe = /[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/
  const leftAngleRe = / {
    if (cm) {
      return toComment(cm)
    }

    if (word === '<') {
      return '<'
    }
    let color
    if (cache[word]) {
      color = cache[word]
    } else {
      color = colors[index]
      cache[word] = color
    }
github xiaojue / AMP / routers / mock.js View on Github external
const apiDeatil = formatRequestUrl(ctx.request.url);
	const Url = global.dbHandle.getModel('urls');

	const result = await Url.find({
		parent_project: apiDeatil.project_id,
		method: ctx.method.toLocaleLowerCase()
	})
	.or([{ url: apiDeatil.api_url }, { url: apiDeatil.api_url.replace(/^\//, '') }]);

	const checkResult = checkReqParams(ctx, result[0]);
	if (checkResult.err) {
		ctx.fail(404, errMap[checkResult.map]);
		return;
	}
	try {
		ctx.body = JSON.parse(result[0].response_example.exapmle_array[result[0].response_example.in_use].replace(commentRegex(), ''));
	} catch (e) {
		ctx.fail(500, '出错啦');
	}
});

comment-regex

Regular expression for matching JavaScript comments

MIT
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis

Popular comment-regex functions