martinandert / inflected Goto Github PK
View Code? Open in Web Editor NEWA port of ActiveSupport's inflector to Node.js and the browser.
License: MIT License
A port of ActiveSupport's inflector to Node.js and the browser.
License: MIT License
Using v2.0.1, I do this:
import {titleize} from 'inflected';
titleize('foo_bar');
And get this error.
Uncaught TypeError: Cannot read property 'underscore' of undefined
at titleize (inflected.js:389)
Hey there!
I'd like to report a security issue but cannot find contact instructions on your repository.
If not a hassle, might you kindly add a SECURITY.md
file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.
Thank you for your consideration, and I look forward to hearing from you!
(cc @huntr-helper)
char
is on the list of reserved words and should be avoided in general.
Specifically, I'm running into the issue as part of browserifying/webpacking a project with es3ify, which replaces dot accessed reserved words that are now part of the API with bracket references.
DEFAULT_APPROXIMATIONS[char])
is replaced as DEFAULT_APPROXIMATIONS["char"])
I think es3ify is being a little overzealous here and I'll report an issue there as well but it would be nice to just not use a "reserved" word.
Hey there fellow Rubyist, thanks for making this available. I noticed a difference in the way inflected handles parameterize
on strings, specifically the separator.
ActiveSupport parameterize
https://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-parameterize
parameterize(string, separator: "-", preserve_case: false)
inflected parameterize
parameterize(string, separator: "")
Example string is the name of a pet from World of Warcraft: Lil' Ben'fon
ActiveSupport parameterize:
"Lil' Ben'fon".parameterize
=> "lil-ben-fon"
inflected parameterize
parameterize("Lil' Ben'fon")
=> `lil-benfon`
Good work guys!
ActiveSupport has a constantize method that turns an input into a CONSTANT_CASE.
If you're interested in the feature, I can look if I find time to contribute it.
Hello,
as you can see in #9 dasherized words are not camelcased. Is this planned for the future? and if so can you give a rough timeline?
If you like I can work on this. :)
Cheers,
Jannis
var Inflector = require('inflected');
console.log(Inflector.singularize('arroces', 'es'));
console.log(Inflector.singularize('autos', 'es'));
console.log(Inflector.singularize('veganos', 'es'));
Outputs the same input!
when attempting to singularize the word "pie", "pies" is correctly returned
but reversing "pies" to singular gives "py" instead of pie.
Hi,
I've been using your library as a dependency of MirageJS. We had a pretty nasty bug in our models where the singularize
method is returning deltum
as the singular of the word delta
.
You can try it with:
Inflector.singularize('delta')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.