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
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/js-yaml/lib/js-yaml/common.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/@rails/webpacker/node_modules/js-yaml/lib/js-yaml/common.js
appmap-0.66.2 ./node_modules/js-yaml/lib/js-yaml/common.js
appmap-0.66.1 ./node_modules/js-yaml/lib/js-yaml/common.js
appmap-0.66.0 ./node_modules/js-yaml/lib/js-yaml/common.js
appmap-0.65.1 ./node_modules/js-yaml/lib/js-yaml/common.js
appmap-0.65.0 ./node_modules/js-yaml/lib/js-yaml/common.js
appmap-0.64.0 ./node_modules/js-yaml/lib/js-yaml/common.js
appmap-0.63.0 ./node_modules/js-yaml/lib/js-yaml/common.js
appmap-0.62.1 ./node_modules/js-yaml/lib/js-yaml/common.js
epuber-stylus-source-0.54.8 vendor/node_modules/js-yaml/lib/common.js
tang-0.2.1 spec/tang_app/node_modules/js-yaml/lib/js-yaml/common.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/js-yaml/lib/js-yaml/common.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/js-yaml/lib/js-yaml/common.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/js-yaml/lib/js-yaml/common.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/js-yaml/lib/js-yaml/common.js
tang-0.2.0 spec/tang_app/node_modules/js-yaml/lib/js-yaml/common.js
tang-0.1.0 spec/tang_app/node_modules/js-yaml/lib/js-yaml/common.js
tang-0.0.9 spec/tang_app/node_modules/js-yaml/lib/js-yaml/common.js
enju_library-0.3.8 spec/dummy/node_modules/js-yaml/lib/js-yaml/common.js