FuncJS

所属分类:TypeScript编程
开发工具:CoffeeScript
文件大小:0KB
下载次数:0
上传日期:2014-02-04 18:34:24
上 传 者sh-1993
说明:  轻量级JavaScript库。它包含14个函数,旨在帮助加快您的编程速度...
(A lightweight JavaScript library. It s packed with 14 functions that are intended to help speed up your programming workflow. Long story short: It just works.)

文件列表:
funcjs.coffee (9071, 2014-02-04)
funcjs.js (8860, 2014-02-04)
funcjs.min.js (7057, 2014-02-04)

## FuncJS 2 **This documentation on GitHub will remain valid until the official documentation goes live.** ##What's new?

FuncJS 2 changes a lot of problems in functions that were present in the initial version of FuncJS. Moreover, 9 functions have been removed from the library as they were next to useless. Ideally, FuncJS 2 is a version of FuncJS that is packed with useful and awesome functions that should've been present in the first place.

You may find that there are still a lot of functions from FuncJS 1 in FuncJS 2. However, these sets of functions are more flexible in terms of how they communicate back to you, usually in the form of error messages.

##Meet the functions In FuncJS 2, there are currently 14 functions. The number would've been 13, if I hadn't added the trim() function. Meet each function in the order in which they appear in the source files.

  1. echo(): The echo() function displays text on screen. This is an alternative to JavaScript's document.write() method.

  2. function_exists(): The function_exists() function checks whether another JavaScript function exists in the page that FuncJS is included in. However, the stability of this function cannot be guaranteed, and the availability of this function is something which I'm thinking over at the moment.

  3. strlen(): The strlen() function counts and returns the number of characters in the string provided as an argument. This is an alternative to JavaScript's element.length method.

  4. strpos(): The strpos() function checks and returns the position of the provided needle in the haystack, that's been provided as an argument. This is an alternative to JavaScript's haystack.indexOf(needle)

  5. str_replace(): The str_replace() function replaces the old value to the new value in the provided string as an argument. This is an alternative to JavaScript's element.replace(old, new)

  6. up(): The up() function capitalizes every letter in the string argument and returns it. This is a nice alternative to JavaScript's element.toUpperCase() method.

  7. down(): Functioning similarly to the up() function, the down() function lowercases every letter in the string argument and returns it. This is a nice alternative to JavaScript's element.toLowerCase() method.

  8. store(): The store() function lets you use a new API for modifying data stored in the local or session storage. For example:
    store("session", "set", "Github", "true"); will create a new key in the session storage called "Github", and will set its value to "true." To remove this key, simply replace the second argument to "remove", and don't provide the last parameter. Similarly, to view the value of a key in any storage, specify the type of storage as the first argument e.g. "session" or "local", the access method e.g. "set", "get" or "remove", and the name of the key as the third argument. Remember, you should only provide the last argument if you're setting a key!

  9. str_rev(): The str_rev function will reverse the order of letters in the provided argument and return it back to you. Handy for quick and easy reversing processes.

  10. grab(): The grab() function functions almost entirely like jQuery's element grabbing. If you're wanting to "grab" an element (hence the name, grab) by targetting its ID or class name, as parameters, provide "#ID" or ".class" to grab the respective elements. If you're wanting to grab an element by targetting its name attribute or tag name, simply write the name of tag as parameters.

  11. trim(): The trim() function will remove any number of whitespace before and/or after the argument, and return the result back to you for you to use.
  12. count(): This function may sound similar to strlen(), but the count() function will count the number of words in the specified argument, and return the result back to you.

  13. strip_tags(): The strip_tags() function will try and remove a good number of HTML tags from the provided argument, if not any. The functionality of this function will constantly improve overtime.

  14. show_tags(): The show_tags() function will display every HTML tag it can detect, similar to PHP's htmlentities() function. This function, from testing, works superbly.

近期下载者

相关文件


收藏者