New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simplex-noise

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simplex-noise - npm Package Compare versions

Comparing version 2.4.0 to 3.0.0

dist/cjs/commonjs-wrapper.d.ts

67

package.json
{
"name": "simplex-noise",
"version": "2.4.0",
"version": "3.0.0",
"description": "simplex-noise is a fast simplex noise implementation in Javascript. Works in node and in the browser.",
"homepage": "https://github.com/jwagner/simplex-noise.js",
"author": "Jonas Wagner <jonas@29a.ch> (http://29a.ch/)",
"main": "./simplex-noise",
"files": "simplex-noise.js",
"source": "simplex-noise.ts",
"main": "dist/cjs/commonjs-wrapper.js",
"module": "dist/esm/simplex-noise.js",
"exports": {
"require": "./dist/cjs/commonjs-wrapper.js",
"import": "./dist/esm/simplex-noise.js"
},
"sideEffects": false,
"files": [
"dist/esm/package.json",
"dist/esm/simplex-noise.js",
"dist/esm/simplex-noise.js.map",
"dist/esm/simplex-noise.d.ts",
"dist/cjs/simplex-noise.js",
"dist/cjs/simplex-noise.js.map",
"dist/cjs/simplex-noise.d.ts",
"dist/cjs/commonjs-wrapper.js",
"dist/cjs/commonjs-wrapper.js.map",
"dist/cjs/commonjs-wrapper.d.ts"
],
"devDependencies": {
"alea": "0.0.9",
"benchmark": "~2.1.4",
"chai": "^4.1.2",
"eslint": "^4.17.0",
"eslint-config-standard": "^11.0.0-beta.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^6.0.0",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1",
"mocha": "^5.0.0"
"@parcel/packager-ts": "^2.0.0-rc.0",
"@parcel/transformer-typescript-types": "^2.0.0-rc.0",
"@types/chai": "^4.2.21",
"@types/mocha": "^9.0.0",
"@types/node": "^16.7.1",
"@types/pngjs": "^6.0.1",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"alea": "^1.0.0",
"benchmark": "^2.1.4",
"chai": "^4.3.4",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.24.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"html-webpack-plugin": "^5.3.2",
"mocha": "^9.1.0",
"parcel": "^2.0.0-rc.0",
"pngjs": "^6.0.0",
"ts-node": "^10.2.1",
"typedoc": "^0.21.6",
"typescript": "^4.3.5",
"webpack": "^5.51.1",
"webpack-cli": "^4.8.0"
},

@@ -40,5 +73,9 @@ "bugs": {

"scripts": {
"test": "eslint simplex-noise.js && mocha",
"benchmark": "node ./perf/benchmark.js"
"start": "parcel test/visual.html",
"test": "eslint simplex-noise.ts && mocha && ./test/module-compatibility.sh",
"build": "./build.sh",
"docs": "typedoc --excludePrivate --out public/docs simplex-noise.ts",
"prepare": "npm run-script build",
"benchmark": "parcel build && node ./perf/benchmark.js"
}
}
# simplex-noise.js
[![Build Status](https://travis-ci.org/jwagner/simplex-noise.js.svg?branch=master)](https://travis-ci.org/jwagner/simplex-noise.js)
simplex-noise.js is a fast simplex noise implementation in Javascript. It works in the browser and on nodejs.
[API Documentation](https://29a.ch/simplex-noise/docs/classes/SimplexNoise.html)
## Requirements
[![Tests](https://github.com/jwagner/simplex-noise.js/actions/workflows/tests.yml/badge.svg)](https://github.com/jwagner/simplex-noise.js/actions/workflows/tests.yml) [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
It requires typed arrays, if you want to use it in browsers without support
you will need to use a polyfill like [typedarray.js](http://www.calormen.com/polyfill/typedarray.js).
simplex-noise.js is a simplex noise implementation in Javascript/TypeScript.
It works in the browser and nodejs. Using Commonjs and ES Modules.
It is self contained (dependency free), relatively small (about 2k minified and gzipped)
and fairly fast (about 20 nanoseconds for a sample of 2d noise).
## Demos
- Simple 2D plasma demo on [codepen.io](http://codepen.io/jwagner/pen/BNmpdm/?editors=001).
- A more complex [3D voxel world generation](http://29a.ch/sandbox/2012/voxelworld/) example.
- Real world usage for creating film grain in my [analog film emulator](http://29a.ch/film-emulator/).
- Simple 2D plasma on [codepen.io](http://codepen.io/jwagner/pen/BNmpdm/?editors=001).
- [3D voxel world generation](http://29a.ch/sandbox/2012/voxelworld/) example.
- Film grain in [analog film emulator](http://29a.ch/film-emulator/).
Created something awesome with simplex-noise? Let me know so I can add it to the list.
## Installation
```npm i -S simplex-noise```
## Usage
```javascript
// when using es modules
import SimplexNoise from 'simplex-noise';
// when using commonjs
const {SimplexNoise} = require('simplex-noise');
```
By default simplex-noise.js will use Math.random() to seed the noise.

@@ -23,3 +38,3 @@ ```javascript

// do this only once as it is relatively expensive
var simplex = new SimplexNoise(),
const simplex = new SimplexNoise(),
value2d = simplex.noise2D(x, y),

@@ -33,3 +48,3 @@ value3d = simplex.noise3D(x, y, z),

```javascript
var simplex = new SimplexNoise('seed'),
const simplex = new SimplexNoise('seed'),
value2d = simplex.noise2D(x, y),

@@ -48,3 +63,3 @@ sameSeed = new SimplexNoise('seed'),

```javascript
var random = new Alea(seed),
const random = new Alea(seed),
simplex = new SimplexNoise(random),

@@ -54,3 +69,3 @@ value2d = simplex.noise2D(x, y);

The ALEA PRNG can be found on in the npm package [alea](https://npmjs.org/package/alea).
The ALEA PRNG can be found in the npm package [alea](https://npmjs.org/package/alea).

@@ -62,3 +77,3 @@ ## node.js

```javascript
var SimplexNoise = require('simplex-noise'),
const SimplexNoise = require('simplex-noise'),
simplex = new SimplexNoise(Math.random),

@@ -70,8 +85,14 @@ value2d = simplex.noise2D(x, y);

- [Comparison between 2D and 3D noise](http://jsperf.com/simplex-noise/4)
- [Comparison with simplex implementation in three.js](http://jsperf.com/simplex-noise-comparison/3)
simplex-noise.js is reasonably quick.
According to `perf/benchmark.js` I can perform about 50 million `noise2D()` calls/second on a single thread on my desktop (Ryzen 5950X).
So ~20 nanoseconds per call.
For development you can open `perf/index.html` and watch the console or run `node perf/benchmark.js` in a shell.
There is also a rake task for comparing your current changes can also run `make compare`.
The command works using git stash.
```
$ node perf/index.js
27745787.933336906
init: 192,590 ops/sec ±1%
noise2D: 57,928,891 ops/sec ±1%
noise3D: 34,159,230 ops/sec ±0%
noise4D: 24,589,786 ops/sec ±0%
```

@@ -87,2 +108,11 @@ ## Tests

### 3.0.0
- Changed module structure. When using bundlers that import the es module even using require() the import might need to be updated.
- Dependency update
- Setting sideEffects: false in package.json
- Added snapshot tests
- Code converted to typescript, the package can of course still be used from regular JS
- Dropped bower
- Added support for es modules
### 2.4.0

@@ -118,4 +148,11 @@ - Included a PRNG based on ALEA to directly allow seeding

## Requirements
It requires typed arrays. If you want to use it in browsers without support
you will need to use a polyfill like [typedarray.js](http://www.calormen.com/polyfill/typedarray.js).
## License
Copyright (c) 2015 Jonas Wagner, licensed under the MIT License (enclosed)
Copyright (c) 2021 Jonas Wagner, licensed under the MIT License (enclosed)

@@ -128,2 +165,2 @@ ## Credits

The typescript definition has been provided by [Neonit](https://github.com/Neonit).
The initial typescript definition has been provided by [Neonit](https://github.com/Neonit).

Sorry, the diff of this file is not supported yet

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