node-powertools
Advanced tools
Comparing version 0.0.10 to 0.0.11
{ | ||
"name": "node-powertools", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Powerful assistive functions for Node and Browser environments.", | ||
"main": "src/index.js", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"test": "./node_modules/mocha/bin/mocha test/ --recursive --timeout=10000" | ||
"test": "./node_modules/mocha/bin/mocha test/ --recursive --timeout=10000", | ||
"prepare": "node ./src/prepare.js" | ||
}, | ||
@@ -32,2 +33,2 @@ "engines": { | ||
} | ||
} | ||
} |
@@ -28,19 +28,32 @@ <p align="center"> | ||
## Install | ||
Install with npm: | ||
## Node Powertools Works in Node AND browser environments | ||
Yes, this module works in both Node and browser environments, including compatibility with [Webpack](https://www.npmjs.com/package/webpack) and [Browserify](https://www.npmjs.com/package/browserify)! | ||
## Features | ||
* Useful **randomization** tools to mix things up | ||
* Helpful **polling** utilities to wait for variables or events | ||
* Powerful **regexify** and **escape** functions to go work with `RegExp` | ||
## Install Node Powertools | ||
### Install via npm | ||
Install with npm if you plan to use **Node Powertools** in a Node.js project or in the browser. | ||
```shell | ||
npm install node-powertools | ||
``` | ||
If you plan to use `node-powertools` in a browser environment, you will probably need to use [Webpack](https://www.npmjs.com/package/webpack), [Browserify](https://www.npmjs.com/package/browserify), or a similar service to compile it. | ||
## Features | ||
* Useful **randomization** tools | ||
* Helpful **polling** utilities | ||
## Example Setup | ||
After installing via npm, simply `require` the library and begin enjoying the powertools 🧰. | ||
```js | ||
// In your functions/index.js file | ||
const powertools = require('node-powertools'); | ||
``` | ||
### Install via CDN | ||
Install with CDN if you plan to use **Node Powertools** only in a browser environment. | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/node-powertools@latest/dist/index.min.js"></script> | ||
<script type="text/javascript"> | ||
var powertools = Powertools(); // The script above exposes the global variable 'Powertools' | ||
</script> | ||
``` | ||
## Usage | ||
@@ -47,0 +60,0 @@ ### powertools.random(min, max, options) |
@@ -116,3 +116,3 @@ (function (root, factory) { | ||
var flags = regex.replace(/.*\/([gimy]*)$/, '$1'); | ||
var pattern = regex.replace(new RegExp(`^/(.*?)/${flags}$`), '$1'); | ||
var pattern = regex.replace(new RegExp('^/(.*?)/' + flags + '$'), '$1'); | ||
return new RegExp(pattern, flags); | ||
@@ -219,3 +219,3 @@ } | ||
} else if (!Array.isArray(result)) { | ||
result = typeof result === 'string' ? result : `${result}`; | ||
result = typeof result === 'string' ? result : (result + ''); | ||
result = result.split(','); | ||
@@ -222,0 +222,0 @@ } |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
32087
7
639
156
1