Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sail-sail/is_property

Tests if a property of a JavaScript object can be accessed using the dot (.) notation or if it must be enclosed in brackets, (ie use x[" ... "])
https://github.com/sail-sail/is_property

Last synced: 1 day ago
JSON representation

Tests if a property of a JavaScript object can be accessed using the dot (.) notation or if it must be enclosed in brackets, (ie use x[" ... "])

Awesome Lists containing this project

README

        

# is_property

Tests if a property of a JavaScript object can be accessed using the dot (.) notation or if it must be enclosed in brackets, (ie use x[" ... "])

## usage
```ts
import { assert } from "https://deno.land/[email protected]/testing/asserts.ts";
import { isProperty } from "https://deno.land/x/[email protected]/mod.ts";

Deno.test("isProperty", function() {
assert(isProperty("foo"))
assert(!isProperty(".foo"))
assert(!isProperty("a.b.c"))
assert(isProperty("_joke"))
assert(isProperty("j_a_b_c"))
assert(isProperty("f00"))
assert(!isProperty("0bad"))
assert(isProperty("break"))
assert(!isProperty("@context"))
});

```