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
immosquare-cleaner-0.1.17 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.16 node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.0.18 scripts/node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.14 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.13 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.12 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.11 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.10 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.9 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.8 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.7 node_modules/js-yaml/lib/common.js
immosquare-cleaner-0.1.6 node_modules/js-yaml/lib/common.js
decidim-0.26.8 packages/webpacker/node_modules/js-yaml/lib/common.js
decidim-0.26.8 packages/eslint-config/node_modules/js-yaml/lib/common.js
decidim-0.27.4 packages/webpacker/node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.0.17 scripts/node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.0.16 scripts/node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.0.15 scripts/node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.0.14 scripts/node_modules/js-yaml/lib/common.js
fattureincloud_ruby_sdk-2.0.13 scripts/node_modules/js-yaml/lib/common.js