Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
can-reflect
Advanced tools
Reflect allows you to reflection on unknown data types.
By looking for symbols in [can-symbol], can-reflect
lets someone act upon
any data type without having to have prior knowledge of it.
var Thing = function(){
};
Thing.prototype.method = function(){}
var canReflect = require("can-reflect");
canReflect.isConstructorLike(Thing) //-> true
The different reflections you can use are grouped by reflection type as follows:
.isConstructorLike
.isFunctionLike
.isIteratorLike
.isListLike
.isMapLike
.isMoreListThanMapLike
(lists can often still be maps).isObservableLike
.isValueLike
.isSymbolLike
.eachIndex
.eachKey
.each
.getOwnEnumerableKeys
(aka .keys
).toArray
.getOwnKeys
.getOwnKeyDescriptor
.getKeyValue
, .setKeyValue
, .deleteKeyValue
- for maps (get
, set
, and delete
are aliases).getValue
, .setValue
- for things like computes.splice
, .addKeys(keyValues[,index])
, .removeKeys(keysOrValues[,index])
(PENDING?).call
.apply
.new
.onKeyValue
, .offKeyValue
.onKeys
- when anything changes.onKeysAdded
, .onKeysRemoved
.getKeyDependencies
- for debugging.keyHasDependencies
.onValue
, .offValue
.getValueDependencies
.valueHasDependencies
.onEvent
, .offEvent
- listen to an event on somethingTODO:
.deleteKeyValue
, .get
and .set
aliasesaddKeys
/ removeKeys
isInitializing
FAQs
reflection on unknown data types
The npm package can-reflect receives a total of 4,131 weekly downloads. As such, can-reflect popularity was classified as popular.
We found that can-reflect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.