Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/sites/node_modules/aws-sdk/lib/dynamodb/ drwxr-xr-x | |
| Viewing file: Select action/file-type: var util = require('../core').util;
var typeOf = require('./types').typeOf;
/**
* @api private
*/
var memberTypeToSetType = {
'String': 'String',
'Number': 'Number',
'NumberValue': 'Number',
'Binary': 'Binary'
};
/**
* @api private
*/
var DynamoDBSet = util.inherit({
constructor: function Set(list, options) {
options = options || {};
this.wrapperName = 'Set';
this.initialize(list, options.validate);
},
initialize: function(list, validate) {
var self = this;
self.values = [].concat(list);
self.detectType();
if (validate) {
self.validate();
}
},
detectType: function() {
this.type = memberTypeToSetType[typeOf(this.values[0])];
if (!this.type) {
throw util.error(new Error(), {
code: 'InvalidSetType',
message: 'Sets can contain string, number, or binary values'
});
}
},
validate: function() {
var self = this;
var length = self.values.length;
var values = self.values;
for (var i = 0; i < length; i++) {
if (memberTypeToSetType[typeOf(values[i])] !== self.type) {
throw util.error(new Error(), {
code: 'InvalidType',
message: self.type + ' Set contains ' + typeOf(values[i]) + ' value'
});
}
}
},
/**
* Render the underlying values only when converting to JSON.
*/
toJSON: function() {
var self = this;
return self.values;
}
});
/**
* @api private
*/
module.exports = DynamoDBSet;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0192 ]-- |