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

caterpillar-browser

Package Overview
Dependencies
Maintainers
2
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

caterpillar-browser - npm Package Compare versions

Comparing version 3.0.0 to 3.2.0-next.1573614272.69c9b497b575b91c9c351a155509a889ec6c9f2f

.dependabot/config.yml

21

HISTORY.md
# History
## v3.2.0 2019 November 13
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
## v3.1.0 2019 January 1
- Updated [base files](https://github.com/bevry/base) and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation)
## v3.0.0 2016 May 4
- Converted from CoffeeScript to JavaScript
- API is now simplified, the class is exported directly, and `createBrowser` is now just `create`
- Converted from CoffeeScript to JavaScript
- API is now simplified, the class is exported directly, and `createBrowser` is now just `create`
## v2.0.1 2013 October 23
- Added `create` API to make life easier when doing one liners
- Project meta data files are now maintained by [Projectz](https://github.com/bevry/projectz)
- Added `create` API to make life easier when doing one liners
- Project meta data files are now maintained by [Projectz](https://github.com/bevry/projectz)
## v2.0.0 2013 May 6
- Initial working release
- Initial working release

@@ -1,3 +0,4 @@

// 2016 March 8
// https://github.com/bevry/editions
'use strict'
/** @type {typeof import("./source/index.js") } */
module.exports = require('editions').requirePackage(__dirname, require)

@@ -18,3 +18,3 @@ <!-- LICENSEFILE/ -->

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.

@@ -21,0 +21,0 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

{
"title": "Browser Transform for [Caterpillar](https://github.com/bevry/caterpillar)",
"name": "caterpillar-browser",
"version": "3.0.0",
"version": "3.2.0-next.1573614272.69c9b497b575b91c9c351a155509a889ec6c9f2f",
"description": "Use Caterpillar within Web Browsers! (even includes support for colors!)",

@@ -29,26 +29,31 @@ "homepage": "https://github.com/bevry/caterpillar-browser",

"---",
"slackin",
"patreon",
"gratipay",
"flattr",
"liberapay",
"buymeacoffee",
"opencollective",
"crypto",
"paypal",
"bitcoin",
"wishlist"
],
"config": {
"buymeacoffeeUsername": "balupton",
"cryptoURL": "https://bevry.me/crypto",
"flattrUsername": "balupton",
"liberapayUsername": "bevry",
"opencollectiveUsername": "bevry",
"patreonUsername": "bevry",
"gratipayUsername": "bevry",
"flattrUsername": "balupton",
"paypalURL": "https://bevry.me/paypal",
"bitcoinURL": "https://bevry.me/bitcoin",
"wishlistURL": "https://bevry.me/wishlist",
"slackinURL": "https://slack.bevry.me"
"travisTLD": "com"
}
},
"funding": "https://bevry.me/fund",
"author": "2013+ Bevry Pty Ltd <us@bevry.me> (http://bevry.me)",
"maintainers": [
"Benjamin Lupton <b@lupton.cc> (https://balupton.com)"
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)"
],
"contributors": [
"Benjamin Lupton <b@lupton.cc> (https://balupton.com)"
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)",
"dependabot-preview[bot] (http://github.com/apps/dependabot-preview)"
],

@@ -60,3 +65,3 @@ "bugs": {

"type": "git",
"url": "http://github.com/bevry/caterpillar-browser.git"
"url": "https://github.com/bevry/caterpillar-browser.git"
},

@@ -68,67 +73,142 @@ "engines": {

{
"description": "Source + ESNext + Require + Flow Type Comments",
"entry": "source/index.js",
"syntaxes": [
"description": "esnext source code with require for modules",
"directory": "source",
"entry": "index.js",
"tags": [
"javascript",
"esnext",
"require",
"classes",
"spread",
"const",
"let",
"destructuring",
"flow type comments"
]
"require"
],
"engines": {
"node": "6 || 8 || 10 || 12 || 13",
"browsers": false
}
},
{
"description": "Babel Compiled + ES2015 + Require",
"entry": "es2015/index.js",
"syntaxes": [
"description": "esnext compiled for browsers with require for modules",
"directory": "edition-browsers",
"entry": "index.js",
"tags": [
"javascript",
"es2015",
"require"
]
],
"engines": {
"node": false,
"browsers": "defaults"
}
},
{
"description": "esnext compiled for node.js 0.12 with require for modules",
"directory": "edition-node-0.12",
"entry": "index.js",
"tags": [
"javascript",
"require"
],
"engines": {
"node": "0.12 || 4 || 6 || 8 || 10 || 12 || 13",
"browsers": false
}
}
],
"main": "index.js",
"browser": "es2015/index.js",
"scripts": {
"setup": "npm install",
"clean": "rm -Rf ./docs ./es2015",
"compile": "npm run compile:es2015",
"compile:es2015": "babel ./source --out-dir ./es2015 --presets es2015",
"meta": "npm run meta:docs && npm run meta:projectz",
"meta:docs": "documentation build -f html -o ./docs -g --shallow ./source/**.js",
"meta:projectz": "projectz compile",
"prepare": "npm run compile && npm run test && npm run meta",
"release": "npm run prepare && npm run release:publish && npm run release:tag && npm run release:push",
"release:publish": "npm publish",
"release:tag": "git tag v$npm_package_version -a",
"release:push": "git push origin master && git push origin --tags",
"pretest": "npm run test:eslint && npm run test:flow",
"test:eslint": "eslint ./source",
"test:flow": "flow check",
"test": "node --harmony ./es2015/test.js"
"browser": "edition-browsers/index.js",
"dependencies": {
"editions": "^2.2.0"
},
"devDependencies": {
"@babel/cli": "^7.7.0",
"@babel/core": "^7.7.2",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/preset-env": "^7.7.1",
"assert-helpers": "4.10.0",
"caterpillar": "^3.3.0",
"caterpillar-human": "^3.0.0",
"eslint": "^6.6.0",
"eslint-config-bevry": "^1.2.1",
"eslint-config-prettier": "^6.5.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-prettier": "^3.1.1",
"jsdoc": "^3.6.3",
"kava": "^3.2.0",
"minami": "^1.2.3",
"prettier": "^1.19.1",
"projectz": "^1.9.0",
"surge": "^0.21.3",
"valid-directory": "^1.0.0"
},
"peerDependencies": {
"caterpillar": "^3.0.0",
"caterpillar": "^3.3.0",
"caterpillar-human": "^3.0.0"
},
"dependencies": {
"editions": "^1.1.1"
"scripts": {
"our:clean": "rm -Rf ./docs ./edition* ./es2015 ./es5 ./out ./.next",
"our:compile": "npm run our:compile:edition-browsers && npm run our:compile:edition-node-0.12",
"our:compile:edition-browsers": "env BABEL_ENV=edition-browsers babel --out-dir ./edition-browsers ./source",
"our:compile:edition-node-0.12": "env BABEL_ENV=edition-node-0.12 babel --out-dir ./edition-node-0.12 ./source",
"our:deploy": "echo no need for this project",
"our:meta": "npm run our:meta:docs && npm run our:meta:projectz",
"our:meta:docs": "npm run our:meta:docs:jsdoc",
"our:meta:docs:jsdoc": "rm -Rf ./docs && jsdoc --recurse --pedantic --access all --destination ./docs --package ./package.json --readme ./README.md --template ./node_modules/minami ./source && mv ./docs/$npm_package_name/$npm_package_version/* ./docs/ && rm -Rf ./docs/$npm_package_name/$npm_package_version",
"our:meta:projectz": "projectz compile",
"our:release": "npm run our:release:prepare && npm run our:release:check-changelog && npm run our:release:check-dirty && npm run our:release:tag && npm run our:release:push",
"our:release:check-changelog": "cat ./HISTORY.md | grep v$npm_package_version || (echo add a changelog entry for v$npm_package_version && exit -1)",
"our:release:check-dirty": "git diff --exit-code",
"our:release:prepare": "npm run our:clean && npm run our:compile && npm run our:test && npm run our:meta",
"our:release:push": "git push origin master && git push origin --tags",
"our:release:tag": "export MESSAGE=$(cat ./HISTORY.md | sed -n \"/## v$npm_package_version/,/##/p\" | sed 's/## //' | awk 'NR>1{print buf}{buf = $0}') && test \"$MESSAGE\" || (echo 'proper changelog entry not found' && exit -1) && git tag v$npm_package_version -am \"$MESSAGE\"",
"our:setup": "npm run our:setup:install",
"our:setup:install": "npm install",
"our:test": "npm run our:verify && npm test",
"our:verify": "npm run our:verify:directory && npm run our:verify:eslint && npm run our:verify:prettier",
"our:verify:directory": "npx valid-directory",
"our:verify:eslint": "eslint --fix --ignore-pattern '**/*.d.ts' --ignore-pattern '**/vendor/' --ignore-pattern '**/node_modules/' --ext .mjs,.js,.jsx,.ts,.tsx ./source",
"our:verify:prettier": "prettier --write ./source/**",
"test": "node ./test.js"
},
"devDependencies": {
"caterpillar": "^3.0.0",
"caterpillar-human": "^3.0.0",
"assert-helpers": "^4.2.0",
"babel-cli": "^6.7.7",
"babel-preset-es2015": "^6.6.0",
"documentation": "^4.0.0-beta2",
"eslint": "^2.9.0",
"eslint-plugin-babel": "^3.2.0",
"flow-bin": "^0.24.0",
"joe": "^1.6.0",
"joe-reporter-console": "^1.2.1",
"projectz": "^1.1.4"
"eslintConfig": {
"extends": [
"bevry"
]
},
"prettier": {
"semi": false,
"singleQuote": true
},
"babel": {
"env": {
"edition-browsers": {
"sourceType": "script",
"presets": [
[
"@babel/preset-env",
{
"targets": "defaults",
"modules": "commonjs"
}
]
],
"plugins": [
"@babel/proposal-object-rest-spread"
]
},
"edition-node-0.12": {
"sourceType": "script",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "0.12"
},
"modules": "commonjs"
}
]
],
"plugins": [
"@babel/proposal-object-rest-spread"
]
}
}
}
}

@@ -10,3 +10,3 @@ <!-- TITLE/ -->

<span class="badge-travisci"><a href="http://travis-ci.org/bevry/caterpillar-browser" title="Check this project's build status on TravisCI"><img src="https://img.shields.io/travis/bevry/caterpillar-browser/master.svg" alt="Travis CI Build Status" /></a></span>
<span class="badge-travisci"><a href="http://travis-ci.com/bevry/caterpillar-browser" title="Check this project's build status on TravisCI"><img src="https://img.shields.io/travis/com/bevry/caterpillar-browser/master.svg" alt="Travis CI Build Status" /></a></span>
<span class="badge-npmversion"><a href="https://npmjs.org/package/caterpillar-browser" title="View this project on NPM"><img src="https://img.shields.io/npm/v/caterpillar-browser.svg" alt="NPM version" /></a></span>

@@ -17,8 +17,9 @@ <span class="badge-npmdownloads"><a href="https://npmjs.org/package/caterpillar-browser" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/caterpillar-browser.svg" alt="NPM downloads" /></a></span>

<br class="badge-separator" />
<span class="badge-slackin"><a href="https://slack.bevry.me" title="Join this project's slack community"><img src="https://slack.bevry.me/badge.svg" alt="Slack community badge" /></a></span>
<span class="badge-patreon"><a href="http://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
<span class="badge-gratipay"><a href="https://www.gratipay.com/bevry" title="Donate weekly to this project using Gratipay"><img src="https://img.shields.io/badge/gratipay-donate-yellow.svg" alt="Gratipay donate button" /></a></span>
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span>
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span>
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span>
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span>
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span>
<span class="badge-bitcoin"><a href="https://bevry.me/bitcoin" title="Donate once-off to this project using Bitcoin"><img src="https://img.shields.io/badge/bitcoin-donate-yellow.svg" alt="Bitcoin donate button" /></a></span>
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span>

@@ -40,25 +41,37 @@

<a href="https://npmjs.com" title="npm is a package manager for javascript"><h3>NPM</h3></a><ul>
<a href="https://npmjs.com" title="npm is a package manager for javascript"><h3>npm</h3></a>
<ul>
<li>Install: <code>npm install --save caterpillar-browser</code></li>
<li>Module: <code>require('caterpillar-browser')</code></li></ul>
<li>Require: <code>require('caterpillar-browser')</code></li>
</ul>
<a href="http://browserify.org" title="Browserify lets you require('modules') in the browser by bundling up all of your dependencies"><h3>Browserify</h3></a><ul>
<li>Install: <code>npm install --save caterpillar-browser</code></li>
<li>Module: <code>require('caterpillar-browser')</code></li>
<li>CDN URL: <code>//wzrd.in/bundle/caterpillar-browser@3.0.0</code></li></ul>
<a href="https://jspm.io" title="Native ES Modules CDN"><h3>jspm</h3></a>
<a href="http://enderjs.com" title="Ender is a full featured package manager for your browser"><h3>Ender</h3></a><ul>
<li>Install: <code>ender add caterpillar-browser</code></li>
<li>Module: <code>require('caterpillar-browser')</code></li></ul>
``` html
<script type="module">
import * as pkg from '//dev.jspm.io/caterpillar-browser'
</script>
```
<h3><a href="https://github.com/bevry/editions" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3>
<h3><a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3>
<p>This package is published with the following editions:</p>
<ul><li><code>caterpillar-browser</code> aliases <code>caterpillar-browser/index.js</code> which uses <a href="https://github.com/bevry/editions" title="Editions are the best way to produce and consume packages you care about.">Editions</a> to automatically select the correct edition for the consumers environment</li>
<li><code>caterpillar-browser/source/index.js</code> is Source + <a href="https://babeljs.io/docs/learn-es2015/" title="ECMAScript Next">ESNext</a> + <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> + <a href="http://flowtype.org/blog/2015/02/20/Flow-Comments.html" title="Flow is a static type checker for JavaScript">Flow Type Comments</a></li>
<li><code>caterpillar-browser/es2015/index.js</code> is <a href="https://babeljs.io" title="The compiler for writing next generation JavaScript">Babel</a> Compiled + <a href="http://babeljs.io/docs/plugins/preset-es2015/" title="ECMAScript 2015">ES2015</a> + <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a></li></ul>
<ul><li><code>caterpillar-browser</code> aliases <code>caterpillar-browser/index.js</code> which uses <a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a> to automatically select the correct edition for the consumers environment</li>
<li><code>caterpillar-browser/source/index.js</code> is esnext source code with require for modules</li>
<li><code>caterpillar-browser/edition-browsers/index.js</code> is esnext compiled for browsers with require for modules</li>
<li><code>caterpillar-browser/edition-node-0.12/index.js</code> is esnext compiled for node.js 0.12 with require for modules</li></ul>
<p>Older environments may need <a href="https://babeljs.io/docs/usage/polyfill/" title="A polyfill that emulates missing ECMAScript environment features">Babel's Polyfill</a> or something similar.</p>
<h3><a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a></h3>
This project provides its type information via inline <a href="http://usejsdoc.org" title="JSDoc is an API documentation generator for JavaScript, similar to Javadoc or phpDocumentor">JSDoc Comments</a>. To make use of this in <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a>, set your <code>maxNodeModuleJsDepth</code> compiler option to `5` or thereabouts. You can accomlish this via your `tsconfig.json` file like so:
``` json
{
"compilerOptions": {
"maxNodeModuleJsDepth": 5
}
}
```
<!-- /INSTALL -->

@@ -69,8 +82,8 @@

[Example.](https://github.com/bevry/caterpillar-examples/master/docs/all.js)
[API Documentation.](http://master.caterpillar-browser.bevry.surge.sh/docs/)
[Example.](https://github.com/bevry/caterpillar-examples/blob/master/all.js)
[Run the example in your web browser.](http://rawgit.com/bevry/caterpillar-examples/master/index.html)
[Documentation.](http://rawgit.com/bevry/caterpillar-browser/master/docs/index.html)
<!-- HISTORY/ -->

@@ -93,3 +106,3 @@

<ul><li><a href="https://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/caterpillar-browser/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/caterpillar-browser">view contributions</a></li></ul>
<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/caterpillar-browser/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/caterpillar-browser">view contributions</a></li></ul>

@@ -100,7 +113,9 @@ <h3>Sponsors</h3>

<span class="badge-patreon"><a href="http://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
<span class="badge-gratipay"><a href="https://www.gratipay.com/bevry" title="Donate weekly to this project using Gratipay"><img src="https://img.shields.io/badge/gratipay-donate-yellow.svg" alt="Gratipay donate button" /></a></span>
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span>
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span>
<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span>
<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span>
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span>
<span class="badge-bitcoin"><a href="https://bevry.me/bitcoin" title="Donate once-off to this project using Bitcoin"><img src="https://img.shields.io/badge/bitcoin-donate-yellow.svg" alt="Bitcoin donate button" /></a></span>
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span>

@@ -112,3 +127,4 @@

<ul><li><a href="https://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/caterpillar-browser/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/caterpillar-browser">view contributions</a></li></ul>
<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/caterpillar-browser/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/caterpillar-browser">view contributions</a></li>
<li><a href="http://github.com/apps/dependabot-preview">dependabot-preview[bot]</a> — <a href="https://github.com/bevry/caterpillar-browser/commits?author=dependabot-preview[bot]" title="View the GitHub contributions of dependabot-preview[bot] on repository bevry/caterpillar-browser">view contributions</a></li></ul>

@@ -115,0 +131,0 @@ <a href="https://github.com/bevry/caterpillar-browser/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a>

@@ -0,8 +1,11 @@

// @ts-check
/* eslint class-methods-use-this:0 */
'use strict'
// Imports
const {Transform} = require('caterpillar')
const { Transform } = require('caterpillar')
/**
Convert human readable Caterpillar entries into browser compatible entries
Extends http://rawgit.com/bevry/caterpillar/master/docs/index.html#Transform
@extends caterpillar.Transform
@extends Transform
@example

@@ -14,3 +17,2 @@ const logger = require('caterpillar').create()

class Browser extends Transform {
/**

@@ -20,3 +22,3 @@ Get the initial configuration.

*/
getInitialConfig () {
getInitialConfig() {
return {

@@ -69,37 +71,44 @@ color: true,

@param {string} message
@returns {string}
@returns {string[]}
*/
format (message /* :string */ ) {
format(message) {
// Prepare
const {color, styles, write} = this.getConfig()
const { color, styles, write } = this.getConfig()
// Replace caterpillar-human formatted entry
const args = []
const result = message.replace(/\u001b\[([0-9]+)m(.+?)\u001b\[([0-9]+)m/g, function (match, start, content, end) {
// Check
if ( color === false ) return content
/* eslint no-control-regex:0 */
const result = message.replace(
/\u001b\[([0-9]+)m(.+?)\u001b\[([0-9]+)m/g,
function(match, start, content, end) {
// Check
if (color === false) return content
// Prepare
let matchedStyle, style
// Prepare
let matchedStyle, style
// Find the matcing style for this combination
for ( const key in styles ) {
if ( styles.hasOwnProperty(key) ) {
style = styles[key]
if ( String(style.start) === String(start) && String(style.end) === String(end) ) {
matchedStyle = style
break
// Find the matcing style for this combination
for (const key in styles) {
if (styles.hasOwnProperty(key)) {
style = styles[key]
if (
String(style.start) === String(start) &&
String(style.end) === String(end)
) {
matchedStyle = style
break
}
}
}
}
// Check
if ( !matchedStyle ) return content
// Check
if (!matchedStyle) return content
// Push the style
args.push(style.value)
args.push(content)
args.push('color:default; font:default; text-decoration:default')
return '%c%s%c'
})
// Push the style
args.push(style.value)
args.push(content)
args.push('color:default; font:default; text-decoration:default')
return '%c%s%c'
}
)

@@ -110,3 +119,3 @@ // Final format

// Write
if ( write ) console.log(...parts)
if (write) console.log(...parts)

@@ -113,0 +122,0 @@ // Return

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