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.1.1 scripts/node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.51 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.50 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.49 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.48 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.47 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.46 node_modules/js-yaml/lib/common.js
pcp-server-ruby-sdk-0.0.6 node_modules/js-yaml/lib/common.js
pcp-server-ruby-sdk-0.1.0 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.45 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.44 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.43 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.42 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.41 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.40 node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.1.0 scripts/node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.39 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.38 node_modules/js-yaml/lib/common.js
decidim-0.26.10 packages/webpacker/node_modules/js-yaml/lib/common.js
optimacms-0.1.61 spec/dummy/node_modules/js-yaml/lib/js-yaml/common.js