Comparing version 2.8.2 to 2.8.3
{ | ||
"name": "rjs", | ||
"version": "2.8.2", | ||
"version": "2.8.3", | ||
"description": "A library of Javascript utility functions with an emphasis on Functional Programming.", | ||
@@ -5,0 +5,0 @@ "main": "rjs.js", |
A library of Javascript utility functions with an emphasis on Functional Programming. | ||
# Usage | ||
# Installation | ||
## Browser Land | ||
<!-- Include RJS library --> | ||
Download rjs.js from the repository, or get it with curl: | ||
curl https://raw.github.com/RaineOrShine/rjs/master/rjs.js > rjs.js | ||
Include it: | ||
<script type="text/javascript" src="rjs.js"></script> | ||
@@ -12,6 +17,23 @@ | ||
RJS = require("./rjs"); | ||
From the command line: | ||
npm install rjs | ||
Or add it as a dependency: | ||
npm view rjs version # find out the latest published version | ||
# add to package.json | ||
"dependencies": { | ||
"rjs": "{VERSION}", | ||
... | ||
npm update | ||
Require it: | ||
RJS = require("rjs"); | ||
# Prototyping Onto Native Objects | ||
While controversial, prototyping functions onto native objects can result in far more elegant code than doing otherwise. | ||
While controversial, prototyping functions onto some native objects can result in especially elegant code. | ||
@@ -21,8 +43,4 @@ The majority of the functions in RJS center around native types like String, Number, Array, and Function, making them | ||
Adding RJS functions to native objects is off by default. To opt-in, call RJS.installPrototypes: | ||
Instead of this: | ||
RJS.installPrototypes(); | ||
Now instead of writing awkward code like this: | ||
RJS.map(people, function(person) { | ||
@@ -32,8 +50,18 @@ return RJS.supplant("Hello {0}!", [person.name]); | ||
We can write elegant, intuitive code like this: | ||
Consider the following: | ||
people.map(function() { | ||
people.map(function(person) { | ||
return "Hello {0}!".supplant([person.name]); | ||
}); | ||
Beautiful! It's more intuitive because it conforms to the subject-verb-object structure of the English language. | ||
Adding RJS functions to native objects is off by default. To opt-in, call RJS.installPrototypes: | ||
RJS.installPrototypes(); | ||
Require and install prototypes in one line: | ||
RJS = require(".rjs").installPrototypes(); | ||
# Unit Tests | ||
@@ -40,0 +68,0 @@ test/index.html |
/** | ||
* Raine's Javascript Extensions | ||
* v2.8.1 | ||
* v2.8.3 | ||
* A library of Javascript utility functions with an emphasis on Functional Programming. | ||
@@ -822,2 +822,3 @@ */ | ||
install(Function, rjs, ['curry', 'rcurry', 'arritize', 'currify', 'toInstance', 'new']); | ||
return rjs; | ||
}; | ||
@@ -824,0 +825,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
530564
32
13011
261