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

rjs

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rjs - npm Package Compare versions

Comparing version 2.7.1 to 2.8.0

deploy/rjs.2.8.0.js

2

package.json
{
"name": "rjs",
"version": "2.7.1",
"version": "2.8.0",
"description": "A library of Javascript utility functions with an emphasis on Functional Programming.",

@@ -5,0 +5,0 @@ "main": "rjs.js",

@@ -10,10 +10,28 @@ A library of Javascript utility functions with an emphasis on Functional Programming.

<!-- Prototypes the functions onto the appropriate native objects (OPTIONAL) -->
<script type="text/javascript" src="rjs-proto.js"></script>
## Node Land
RJS = require("./rjs");
require("./rjs-proto"); // optional
# Prototyping Onto Native Objects
While controversial, prototyping functions onto native objects can result in far more elegant code than doing otherwise.
The majority of the functions in RJS center around native types like String, Number, Array, and Function, making them
perfect candidates for prototyping. Nothing is prototyped onto Object.
Adding RJS functions to native objects is off by default. To opt-in, call RJS.installPrototypes:
RJS.installPrototypes();
Now instead of writing awkward code like this:
RJS.map(people, function(person) {
return RJS.supplant("Hello {0}!", [person.name]);
});
We can write elegant, intuitive code like this:
people.map(function() {
return "Hello {0}!".supplant([person.name]);
});
# Unit Tests

@@ -20,0 +38,0 @@ test/index.html

/**
* Raine's Javascript Extensions
* v2.7.1
* v2.8.0
* A library of Javascript utility functions with an emphasis on Functional Programming.

@@ -105,3 +105,2 @@ */

/***********************************

@@ -793,3 +792,20 @@ * String

// export public interface
/***********************************
* Prototype Installation
***********************************/
var installPrototypes = function(rjs) {
var rjs = rjs || RJS;
install(String, rjs, ["supplant", "trim", "startsWith", "before", "after", "between", { repeatString: "repeat" }, "toTitleCase", { strContains: "contains" } ]);
install(Number, rjs, ["ordinal", { mapNumber: "map" }]);
install(Array, rjs, ["map", "each", "pluck", "group", "orderedGroup", "tally", "contains", "strictContains", "unique", "reversed", "index", "rotate", "toObject", "find", "findByProperty", "filterBy", "any", "all" ]);
install(Function, rjs, ["curry", "currify", "toInstance", "new"]);
};
/***********************************
* Export Public Interface
***********************************/
return {

@@ -867,3 +883,6 @@

"new" : createNew,
callAfterDone : callAfterDone
callAfterDone : callAfterDone,
// prototype installation
installPrototypes : installPrototypes
};

@@ -870,0 +889,0 @@

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