Sha256: 6b4072fd7f721f7da0c26473e73a80667e80bc0ad45bd6523cdafc19b935933a

Contents?: true

Size: 773 Bytes

Versions: 40

Compression:

Stored size: 773 Bytes

Contents

// https://github.com/ljharb/proposal-string-pad-left-right
var toLength = require('./$.to-length')
  , repeat   = require('./$.string-repeat')
  , defined  = require('./$.defined');

module.exports = function(that, maxLength, fillString, left){
  var S            = String(defined(that))
    , stringLength = S.length
    , fillStr      = fillString === undefined ? ' ' : String(fillString)
    , intMaxLength = toLength(maxLength);
  if(intMaxLength <= stringLength)return S;
  if(fillStr == '')fillStr = ' ';
  var fillLen = intMaxLength - stringLength
    , stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
  if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen);
  return left ? stringFiller + S : S + stringFiller;
};

Version data entries

40 entries across 18 versions & 7 rubygems

Version Path
ilog-0.4.1 node_modules/core-js/modules/$.string-pad.js
ilog-0.4.1 node_modules/core-js/library/modules/$.string-pad.js
ilog-0.4.0 node_modules/core-js/modules/$.string-pad.js
ilog-0.4.0 node_modules/core-js/library/modules/$.string-pad.js
ilog-0.3.3 node_modules/core-js/modules/$.string-pad.js
ilog-0.3.3 node_modules/core-js/library/modules/$.string-pad.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/fbjs/node_modules/core-js/library/modules/$.string-pad.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/fbjs/node_modules/core-js/modules/$.string-pad.js
locomotivecms-3.4.0 app/javascript/node_modules/fbjs/node_modules/core-js/modules/$.string-pad.js
locomotivecms-3.4.0 app/javascript/node_modules/fbjs/node_modules/core-js/library/modules/$.string-pad.js
cortex-0.1.3 spec/dummy/node_modules/fbjs/node_modules/core-js/library/modules/$.string-pad.js
cortex-0.1.3 spec/dummy/node_modules/fbjs/node_modules/core-js/modules/$.string-pad.js
lanes-0.8.0 node_modules/core-js/library/modules/$.string-pad.js
lanes-0.8.0 node_modules/core-js/modules/$.string-pad.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/core-js/modules/$.string-pad.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/core-js/library/modules/$.string-pad.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/core-js/modules/$.string-pad.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/core-js/library/modules/$.string-pad.js
babel-schmooze-sprockets-0.1.3 node_modules/core-js/modules/$.string-pad.js
babel-schmooze-sprockets-0.1.3 node_modules/core-js/library/modules/$.string-pad.js