Sha256: 9211491f8e0058a419a4664e36bb4ec6509655aabe6bd537eddf941fdf34e734

Contents?: true

Size: 1.15 KB

Versions: 190

Compression:

Stored size: 1.15 KB

Contents

'use strict';


function isNothing(subject) {
  return (typeof subject === 'undefined') || (subject === null);
}


function isObject(subject) {
  return (typeof subject === 'object') && (subject !== null);
}


function toArray(sequence) {
  if (Array.isArray(sequence)) return sequence;
  else if (isNothing(sequence)) return [];

  return [ sequence ];
}


function extend(target, source) {
  var index, length, key, sourceKeys;

  if (source) {
    sourceKeys = Object.keys(source);

    for (index = 0, length = sourceKeys.length; index < length; index += 1) {
      key = sourceKeys[index];
      target[key] = source[key];
    }
  }

  return target;
}


function repeat(string, count) {
  var result = '', cycle;

  for (cycle = 0; cycle < count; cycle += 1) {
    result += string;
  }

  return result;
}


function isNegativeZero(number) {
  return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
}


module.exports.isNothing      = isNothing;
module.exports.isObject       = isObject;
module.exports.toArray        = toArray;
module.exports.repeat         = repeat;
module.exports.isNegativeZero = isNegativeZero;
module.exports.extend         = extend;

Version data entries

190 entries across 174 versions & 22 rubygems

Version Path
fattureincloud_ruby_sdk-2.0.12 scripts/node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.0.11 scripts/node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.0.10 scripts/node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.0.9 scripts/node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.0.8 scripts/node_modules/js-yaml/lib/common.js
disco_app-0.18.0 test/dummy/node_modules/js-yaml/lib/js-yaml/common.js
disco_app-0.18.2 test/dummy/node_modules/js-yaml/lib/js-yaml/common.js
fattureincloud_ruby_sdk-2.0.7 scripts/node_modules/js-yaml/lib/common.js
epuber-stylus-source-0.56.0 vendor/node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.0.6 scripts/node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.0.5 scripts/node_modules/js-yaml/lib/common.js
appmap-0.72.2 ./node_modules/js-yaml/lib/js-yaml/common.js
fattureincloud_ruby_sdk-2.0.4 scripts/node_modules/js-yaml/lib/common.js
appmap-0.72.1 ./node_modules/js-yaml/lib/js-yaml/common.js
fattureincloud_ruby_sdk-2.0.3 scripts/node_modules/js-yaml/lib/common.js
appmap-0.72.0 ./node_modules/js-yaml/lib/js-yaml/common.js
appmap-0.71.0 ./node_modules/js-yaml/lib/js-yaml/common.js
disco_app-0.16.1 test/dummy/node_modules/@rails/webpacker/node_modules/js-yaml/lib/js-yaml/common.js
disco_app-0.16.1 test/dummy/node_modules/js-yaml/lib/js-yaml/common.js
appmap-0.70.2 ./node_modules/js-yaml/lib/js-yaml/common.js