New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

can-reflect

Package Overview
Dependencies
Maintainers
8
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-reflect - npm Package Compare versions

Comparing version 1.10.2 to 1.11.0

2

package.json
{
"name": "can-reflect",
"version": "1.10.2",
"version": "1.11.0",
"description": "reflection on unknown data types",

@@ -5,0 +5,0 @@ "homepage": "http://canjs.com",

@@ -43,9 +43,47 @@ var canSymbol = require("can-symbol");

*
* @body
*
* The [@@@can.getName](can-symbol/symbols/getName.html) symbol is used to
* provide objects human readable names; the main goal of these names is to help
* users get a glance of what the object does and what it is used for.
*
* There are no hard rules to define names but CanJS uses the following convention
* for consistent names across its observable types:
*
* - The name starts with the observable constructor name
* - The constructor name is decorated with the following characters based on its type:
* - `<>`: for [value-like](can-reflect.isValueLike.html) observables, e.g: `SimpleObservable<>`
* - `[]`: for [list-like](can-reflect.isListLike.html) observables, e.g: `DefineList[]`
* - `{}`: for [map-like](can-reflect.isMapLike.html) observables, e.g: `DefineMap{}`
* - Any property that makes the instance unique (like ids) are printed inside
* the chars mentioned before.
*
* The example below shows how to implement [@@@can.getName](can-symbol/symbols/getName.html),
* in a value-like observable (similar to [can-simple-observable]).
*
* ```js
* var canReflect = require("can-reflect");
*
* function MySimpleObservable(value) {
* this.value = value;
* }
*
* canReflect.assignSymbols(MySimpleObservable.prototype, {
* "can.getName": function() {
* //!steal-remove-start
* var value = JSON.stringify(this.value);
* return canReflect.getName(this.constructor) + "<" + value + ">";
* //!steal-remove-end
* }
* });
* ```
* var map = new DefineMap();
*
* canReflect.getName(map); //-> "DefineMap{}"
* With that in place, `MySimpleObservable` can be used like this:
*
* ```js
* var one = new MySimpleObservable(1);
* canReflect.getName(one); // MySimpleObservable<1>
* ```
*
* @param {Object} obj the object to get from
* @param {Object} obj The object to get from
* @return {String} The human-readable name of the object

@@ -52,0 +90,0 @@ */

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