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

string.prototype.repeat

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string.prototype.repeat - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

2

package.json
{
"name": "string.prototype.repeat",
"version": "0.1.0",
"version": "0.2.0",
"description": "A robust & optimized `String.prototype.repeat` polyfill, based on the ECMAScript 6 specification.",

@@ -5,0 +5,0 @@ "homepage": "http://mths.be/repeat",

@@ -1,2 +0,2 @@

# ES6 `String.prototype.repeat` polyfill [![Build status](https://travis-ci.org/mathiasbynens/String.prototype.repeat.png?branch=master)](https://travis-ci.org/mathiasbynens/String.prototype.repeat)
# ES6 `String.prototype.repeat` polyfill [![Build status](https://travis-ci.org/mathiasbynens/String.prototype.repeat.svg?branch=master)](https://travis-ci.org/mathiasbynens/String.prototype.repeat)

@@ -35,3 +35,3 @@ A robust & optimized ES3-compatible polyfill for [the `String.prototype.repeat` method in ECMAScript 6](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.repeat).

| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") |
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|---|

@@ -38,0 +38,0 @@ | [Mathias Bynens](http://mathiasbynens.be/) |

@@ -1,5 +0,14 @@

/*! http://mths.be/repeat v0.1.0 by @mathias */
/*! http://mths.be/repeat v0.2.0 by @mathias */
if (!String.prototype.repeat) {
(function() {
'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
var defineProperty = (function() {
// IE 8 only supports `Object.defineProperty` on DOM elements
try {
var object = {};
var $defineProperty = Object.defineProperty;
var result = $defineProperty(object, object, object) && $defineProperty;
} catch(error) {}
return result;
}());
var repeat = function(count) {

@@ -19,13 +28,16 @@ if (this == null) {

}
if (n == 0) {
return '';
}
var result = '';
while (n--) {
result += string;
while (n) {
if (n % 2 == 1) {
result += string;
}
if (n > 1) {
string += string;
}
n >>= 1;
}
return result;
};
if (Object.defineProperty) {
Object.defineProperty(String.prototype, 'repeat', {
if (defineProperty) {
defineProperty(String.prototype, 'repeat', {
'value': repeat,

@@ -32,0 +44,0 @@ 'configurable': true,

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