#2 new
MadRabbit

String#escapeHTML #truncate ???

Reported by MadRabbit | June 10th, 2009 @ 01:31 PM

Think about creating escapeHTML/truncate methods for the String class.

Comments and changes to this ticket

  • MadRabbit

    MadRabbit June 10th, 2009 @ 01:31 PM

    • Tag set to feature
  • MadRabbit

    MadRabbit June 10th, 2009 @ 01:47 PM

    [project:ID#31989 bulk edit command]

  • Douwe M.

    Douwe M. February 16th, 2010 @ 03:48 PM

    Bump. A String#truncate method would be really nice

  • MadRabbit

    MadRabbit February 16th, 2010 @ 04:08 PM

    Hey Douwe,

    There is a plugin called lang in the goods repository which meant to keep all the additional language methods and features. I honestly don't have much time to get on it yet, because currently busy with the core and plugins, but if you're interested you could help by implementing those methods by yourself. Say add the string methods over here

    http://github.com/rightjs/rightjs-goods/blob/master/src/lang/string.js

    There is also some spikes for Hash and NumRange units, but I'm not sure about their implementation yet, think it requires to have the Enumerable module first and then implement them properly using it.

    If you will work on them, plz, write tests ;)

  • Douwe M.
  • Douwe M.

    Douwe M. February 16th, 2010 @ 05:12 PM

    Okay, I added the String#truncate method and pushed it to GitHub (haven't pulled a request to get it to you yet).
    I'm not sure what to do with the rest of the things I suggested, though. I could make most of those changes / add methods myself, but I'm not sure what should be in the rightjs-core repo, and what in the rightjs-goods repo, and I don't know if you even want me messing with stuff in the rightjs-core repo... Anyways, I'd be happy to help you.

  • MadRabbit

    MadRabbit February 16th, 2010 @ 05:23 PM

    That's simple, all of them should be in goods.

    The idea is following: the core contains only the strictly necessary methods, the ones that needed by 99% of cases, things like 'trim', 'startsWith', 'includes', and so one.

    Case specific features like 'truncate', 'escapeHTML' and so one, will go in the lang plugin.

    I know it depends on a point of view and needs of every developer, but I think a good practice will be to add fancy methods to the plugin, and later, if there will be people asking, we always can easily move them to the core.

    In any case having them in a plugin IMHO a good approach, coz it will be easy to switch them on and off during the custom build process, and then if you need just one method in your app, you always can simply copy it manually from the plugin.

    Kinda like that.

  • Douwe M.

    Douwe M. February 16th, 2010 @ 05:37 PM

    Well, I was actually talking about these:

    Tickets

    (Nearly) All of which already are in rightjs-core...

  • MadRabbit

    MadRabbit February 16th, 2010 @ 05:46 PM

    I see, haven't seen them yet. But think we can deal them one by one.

    I'll go through them tonight

  • Douwe M.

    Douwe M. February 16th, 2010 @ 05:51 PM

    K :) Hope I don't steal all your time by posting so many tickets ;)

  • MadRabbit

    MadRabbit February 16th, 2010 @ 05:55 PM

    no problem at all. the more ideas the better

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

RightJS Core Tickets

Shared Ticket Bins

People watching this ticket

Tags

Pages