Socket
Socket
Sign inDemoInstall

magic-string

Package Overview
Dependencies
1
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3 to 0.1.4

6

CHANGELOG.md
# changelog
## 0.1.4
* `s.locate()` doesn't throw out-of-bound error if index is equal to original string's length
## 0.1.3

@@ -17,2 +21,2 @@

* First release
* First release

4

lib/index.js

@@ -88,3 +88,3 @@ var guessIndent = require( './guessIndent' ),

if ( character < 0 || character >= this.mappings.length ) {
if ( character < 0 || character > this.mappings.length ) {
throw new Error( 'Character is out of bounds' );

@@ -148,3 +148,3 @@ }

firstChar = this.locate( start );
lastChar = this.locate( end );
lastChar = this.locate( end - 1 ) + 1;

@@ -151,0 +151,0 @@ if ( firstChar === null || lastChar === null ) {

{
"name": "magic-string",
"author": "Rich Harris",
"version": "0.1.3",
"version": "0.1.4",
"main": "index.js",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -124,3 +124,3 @@ var assert = require( 'assert' ),

assert.throws( function () { s.locate( -1 ); });
assert.throws( function () { s.locate( 12 ); });
assert.throws( function () { s.locate( 13 ); });
});

@@ -303,2 +303,9 @@

it( 'should replace characters at the end of the original string', function () {
var s = new MagicString( 'abcdefghijkl' );
s.replace( 12, 12, '<<<' );
assert.equal( s.toString(), 'abcdefghijkl<<<' );
});
it( 'should return this', function () {

@@ -352,2 +359,2 @@ var s = new MagicString( 'abcdefghijkl' );

});
});
});
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc