<commit_before>'use strict';

var memoize       = require('memoizee/plain')
  , validDbjs     = require('dbjs/valid-dbjs')
  , isNumber      = require('es5-ext/object/is-number-value')
  , assign        = require('es5-ext/object/assign')
  , isString      = require('es5-ext/string/is-string')
  , camelToHyphen = require('es5-ext/string/#/camel-to-hyphen')
  , max           = Math.max;

module.exports = memoize(function (db) {
	return validDbjs(db).Number.extend('Currency', {
		step: { value: 0.01 },
		// Possible values:
		// * symbol - uses symbol if provided
		// * code - uses isoCode if provided
		// * name - uses hyphenated class name
		currencyDisplay: { type: db.String, value: 'symbol' },
		// ISO 4217 currency code
		isoCode: { type: db.String, required: true },
		// Currency symbol such as € or $
		symbol: { type: db.String, required: true },
		format: { type: db.Function, value: function (value/*, options*/) {
			var options = assign({ style: 'currency' }, Object(arguments[1]))
			  , locale  = options.locale
			  , intPart, fraction, decSep, numSep, prefix;

			// Handle non-numbers forst
			if (isNaN(value)) return 'Invalid value';
			value = Number(value);
			if (!isFinite(value)) return String(value);

			// Use Intl if available and we have what we need
			if ((typeof Intl !== 'undefined') && (typeof Intl.NumberFormat === 'function')
					&& locale && options.currency) {
				// Sanitize options to prevent breaking something if Intl API changes
				delete options.locale;
				delete options.symbol;
				delete options.decSep;
				delete options.numSep;
				return value.toLocaleString(locale, options);
			}

			// Try our best without Intl
			value = value.toFixed(isNaN(options.minimumFractionDigits) ? 2
				: options.minimumFractionDigits).split('.');
			intPart = value[0];
			fraction = value[1] || '';
			decSep = options.decSep || '.';
			numSep = options.numSep || '\'';

			if (options.currencyDisplay === 'name') {<commit_msg>Remove assign usage from format getter.<commit_after>'use strict';

var memoize       = require('memoizee/plain')
  , validDbjs     = require('dbjs/valid-dbjs')
  , isNumber      = require('es5-ext/object/is-number-value')
  , isString      = require('es5-ext/string/is-string')
  , camelToHyphen = require('es5-ext/string/#/camel-to-hyphen')
  , max           = Math.max;

module.exports = memoize(function (db) {
	return validDbjs(db).Number.extend('Currency', {
		step: { value: 0.01 },
		// Possible values:
		// * symbol - uses symbol if provided
		// * code - uses isoCode if provided
		// * name - uses hyphenated class name
		currencyDisplay: { type: db.String, value: 'symbol' },
		// ISO 4217 currency code
		isoCode: { type: db.String, required: true },
		// Currency symbol such as € or $
		symbol: { type: db.String, required: true },
		format: { type: db.Function, value: function (value/*, options*/) {
			var options = Object(arguments[1])
			  , locale  = options.locale
			  , intPart, fraction, decSep, numSep, prefix;

			options.style = 'currency';

			// Handle non-numbers forst
			if (isNaN(value)) return 'Invalid value';
			value = Number(value);
			if (!isFinite(value)) return String(value);

			// Use Intl if available and we have what we need
			if ((typeof Intl !== 'undefined') && (typeof Intl.NumberFormat === 'function')
					&& locale && options.currency) {
				// Sanitize options to prevent breaking something if Intl API changes
				delete options.locale;
				delete options.symbol;
				delete options.decSep;
				delete options.numSep;
				return value.toLocaleString(locale, options);
			}

			// Try our best without Intl
			value = value.toFixed(isNaN(options.minimumFractionDigits) ? 2
				: options.minimumFractionDigits).split('.');
			intPart = value[0];
			fraction = value[1] || '';
			decSep = options.decSep || '.';
			numSep = options.numSep || '\'';

			if (options.currencyDisplay === 'name') {
{'fraction_non_alphanumeric': 0.14660887302396736, 'fraction_numerical': 0.007394186639469658, 'mean_word_length': 3.1778487752928646, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3053929', 'n_tokens_mistral': 1396, 'n_tokens_neox': 1218, 'n_words': 324}