Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

glsl-token-whitespace-trim

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glsl-token-whitespace-trim

Trim the whitespace within an array of GLSL tokens

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
175K
decreased by-28.65%
Maintainers
1
Weekly downloads
 
Created
Source

glsl-token-whitespace-trim

stable

Trim the whitespace within an array of GLSL tokens provided by glsl-tokenizer. Useful for minimising shader source size, especially after heavy processing steps such as seen in glslify or as part of a GLSL minifier.

Usage

NPM

trim(tokens, [all])

Trims the whitespace in an array of GLSL tokens. By default, this will trim repeated to newlines such that no more than two newlines will appear in a row.

If you're more concerned about size than aesthetics, you can pass true as the second argument to remove all extraneous whitespace (more or less).

const tokenize = require('glsl-tokenizer')
const string = require('glsl-token-string')
const trim = require('glsl-token-whitespace-trim')
const fs = require('fs')

const src = fs.readFileSync('shader.glsl', 'utf8')
const tokens = tokenize(src)

trim(tokens, true)

const trimmed = string(tokens)

License

MIT, see LICENSE.md for details.

Keywords

FAQs

Package last updated on 24 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc