Code coverage report for dynamoDb-marshaler/lib/commands/marshalNumberSet.js

Statements: 100% (7 / 7)      Branches: 100% (6 / 6)      Functions: 100% (2 / 2)      Lines: 100% (7 / 7)      Ignored: none     

All files » dynamoDb-marshaler/lib/commands/ » marshalNumberSet.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21    1   1 5           4     1 2     1    
'use strict';
 
var _ = require('lodash');
 
module.exports = function(item) {
  if (
    !_.isArray(item) ||
    _.isEmpty(item) ||
    !_.every(item, _.isNumber) ||
    _.uniq(item).length !== item.length
  ) {
    return undefined;
  }
 
  item = _.map(item, function stringify(num) {
    return num.toString();
  });
 
  return {NS: item};
};