Dashboard sipadu mbip
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718
  1. 'use strict';
  2. var values = require('../helpers/values');
  3. module.exports = function random() {
  4. var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  5. var items = values(this.items);
  6. var collection = new this.constructor(items).shuffle();
  7. // If not a length was specified
  8. if (length !== parseInt(length, 10)) {
  9. return collection.first();
  10. }
  11. return collection.take(length);
  12. };