Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

inflect

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inflect - npm Package Compare versions

Comparing version 0.1.5 to 0.2.0

client/inflect.js

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 0.2.0 (unreleased)
* client side support
## 0.1.4 (10th November, 2011)

@@ -2,0 +6,0 @@

3

lib/index.js

@@ -1,1 +0,2 @@

module.exports = require("./inflect");
module.exports = require("./inflect");
var inflect;
inflect = require('../inflect');
inflect.inflections(function(inflect) {

@@ -74,2 +76,2 @@ inflect.plural(/$/, 's');

return inflect.uncountable('rhinoceros', 'swine', 'you', 'news');
});
});
var Inflections, inflections, methods, number_extensions, string_extensions, version;
version = require('./version');
exports.package = version.package;
exports.version = version.version;
Inflections = require('./inflections').Inflections;
inflections = function(callback) {
if (callback != null) {
callback.call(this, Inflections.instance());
}
if (callback != null) callback.call(this, Inflections.instance());
return Inflections.instance();
};
exports.Inflections = Inflections;
exports.inflections = inflections;
methods = require('./methods');
exports.camelize = methods.camelize;
exports.underscore = methods.underscore;
exports.dasherize = methods.dasherize;
exports.titleize = methods.titleize;
exports.capitalize = methods.capitalize;
exports.pluralize = methods.pluralize;
exports.singularize = methods.singularize;
exports.humanize = methods.humanize;
exports.ordinalize = methods.ordinalize;
exports.parameterize = methods.parameterize;
string_extensions = require('./string_extensions');
number_extensions = require('./number_extensions');
exports.enableStringExtensions = string_extensions.enableStringExtensions;
exports.enableNumberExtensions = number_extensions.enableNumberExtensions;
exports.enableExtensions = function() {

@@ -33,2 +54,3 @@ string_extensions.enableStringExtensions();

};
require('./default_inflections');
require('./default_inflections');
var Inflections;
var __slice = Array.prototype.slice;
Inflections = (function() {
Inflections.instance = function() {
return this.__instance__ || (this.__instance__ = new this);
};
function Inflections() {

@@ -13,2 +16,3 @@ this.plurals = [];

}
Inflections.prototype.plural = function(rule, replacement) {

@@ -24,2 +28,3 @@ var index;

};
Inflections.prototype.singular = function(rule, replacement) {

@@ -35,2 +40,3 @@ var index;

};
Inflections.prototype.irregular = function(singular, plural) {

@@ -57,2 +63,3 @@ var index;

};
Inflections.prototype.uncountable = function() {

@@ -63,9 +70,9 @@ var words;

};
Inflections.prototype.human = function(rule, replacement) {
return this.humans.unshift([rule, replacement]);
};
Inflections.prototype.clear = function(scope) {
if (scope == null) {
scope = 'all';
}
if (scope == null) scope = 'all';
if (scope === 'all') {

@@ -80,4 +87,7 @@ this.plurals = [];

};
return Inflections;
})();
exports.Inflections = Inflections;
exports.Inflections = Inflections;
var camelize, capitalize, dasherize, humanize, inflections, ordinalize, parameterize, pluralize, singularize, titleize, underscore;
inflections = require('../inflect').inflections;
camelize = function(lower_case_and_underscored_word, first_letter_in_uppercase) {
var rest;
if (first_letter_in_uppercase == null) {
first_letter_in_uppercase = true;
}
if (first_letter_in_uppercase == null) first_letter_in_uppercase = true;
rest = lower_case_and_underscored_word.replace(/_./g, function(val) {

@@ -17,2 +17,3 @@ return val.slice(1).toUpperCase();

};
underscore = function(camel_cased_word) {

@@ -27,5 +28,7 @@ var word;

};
dasherize = function(underscored_word) {
return underscored_word.replace(/_/g, '-');
};
titleize = function(word) {

@@ -36,5 +39,7 @@ return humanize(underscore(word)).replace(/\b('?[a-z])/g, function(val) {

};
capitalize = function(word) {
return (word[0] || '').toUpperCase() + (word.slice(1) || '').toLowerCase();
};
pluralize = function(word) {

@@ -59,2 +64,3 @@ var plural, replacement, result, rule, _i, _len, _ref;

};
singularize = function(word) {

@@ -88,2 +94,3 @@ var inflection, replacement, result, rule, singular, uncountable, _i, _j, _len, _len2, _ref, _ref2;

};
humanize = function(lower_case_and_underscored_word) {

@@ -104,2 +111,3 @@ var human, replacement, result, rule, _i, _len, _ref;

};
ordinalize = function(number) {

@@ -114,9 +122,6 @@ var number_int;

return "" + number + "st";
break;
case 2:
return "" + number + "nd";
break;
case 3:
return "" + number + "rd";
break;
default:

@@ -127,7 +132,6 @@ return "" + number + "th";

};
parameterize = function(string, sep) {
var parameterized_string;
if (sep == null) {
sep = '-';
}
if (sep == null) sep = '-';
parameterized_string = string.toString();

@@ -141,11 +145,21 @@ parameterized_string = parameterized_string.replace(/[^a-z0-9\-_]+/gi, sep);

};
exports.camelize = camelize;
exports.underscore = underscore;
exports.dasherize = dasherize;
exports.titleize = titleize;
exports.capitalize = capitalize;
exports.pluralize = pluralize;
exports.singularize = singularize;
exports.humanize = humanize;
exports.ordinalize = ordinalize;
exports.parameterize = parameterize;
exports.parameterize = parameterize;
var enableNumberExtensions, inflect;
inflect = require('../inflect');
enableNumberExtensions = function() {

@@ -8,2 +10,3 @@ return Number.prototype.ordinalize = function() {

};
exports.enableNumberExtensions = enableNumberExtensions;
exports.enableNumberExtensions = enableNumberExtensions;
var enableStringExtensions, inflect;
inflect = require('../inflect');
enableStringExtensions = function() {

@@ -11,5 +13,3 @@ String.prototype.pluralize = function() {

String.prototype.camelize = function(first_letter_in_uppercase) {
if (first_letter_in_uppercase == null) {
first_letter_in_uppercase = true;
}
if (first_letter_in_uppercase == null) first_letter_in_uppercase = true;
return inflect.camelize(this, first_letter_in_uppercase);

@@ -30,5 +30,3 @@ };

String.prototype.parameterize = function(sep) {
if (sep == null) {
sep = '-';
}
if (sep == null) sep = '-';
return inflect.parameterize(this, sep);

@@ -40,2 +38,3 @@ };

};
exports.enableStringExtensions = enableStringExtensions;
exports.enableStringExtensions = enableStringExtensions;

@@ -1,4 +0,13 @@

var path;
var data, path;
path = require('path');
exports.package = JSON.parse(require('fs').readFileSync(path.join(__dirname, '/../../package.json')));
exports.version = exports.package.version;
if (process.title === 'browser') {
data = require('files')['package.json'];
} else {
data = require('fs').readFileSync(path.join(__dirname, '/../../package.json'));
}
exports.package = JSON.parse(data);
exports.version = exports.package.version;

@@ -5,3 +5,3 @@ {

"keywords": ["inflect", "activerecord", "rails", "activesupport", "string"],
"version": "0.1.5",
"version": "0.2.0",
"author": "Stefan Huber <MSNexploder@gmail.com>",

@@ -33,3 +33,6 @@ "homepage": "http://msnexploder.github.com/inflect/",

"docco": ">= 0.3.0 < 0.4.0",
"vows": ">= 0.5.13 < 0.6.0"
"vows": ">= 0.6.0 < 0.7.0",
"browserify": ">= 1.8.1 < 1.9.0",
"fileify": ">= 0.3.1 < 0.4.0",
"uglify-js": ">= 1.1.1 < 1.2.0"
},

@@ -36,0 +39,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc