CSML Reference
  • Introduction
  • Installing CSML
  • Sending and Receiving Messages
    • Message Payloads
    • Custom Components
  • The Event
  • Memory
    • Using Variables in Messages
    • Temporary and Long-Term variables
    • Global variables
  • Navigating in a CSML Bot
  • Conditional Logic
  • External Code Execution
  • Native CSML Functions
  • Value Types
  • Automatic Type Inference
  • 📑CSML Studio Documentation
  • Standard Library
    • Keywords
    • Built-in Functions
    • HTTP Client
    • SMTP Client
    • Crypto Utilities
      • JWT
      • Hash, HMAC
      • Base64, Hex
    • String methods
    • Array methods
    • Object methods
    • Number methods
    • Generic methods
Powered by GitBook
On this page
  • .keys()
  • .values()
  • .remove(String)
  • .length()
  • .assign(b)

Was this helpful?

Edit on Git
Export as PDF
  1. Standard Library

Object methods

.keys()

Return the list of all 1st-level properties in the target object.

object.keys() => Array[String]

// example
do val = { "toto": 1, "tutu": 2 }
do val.keys() // ["toto", "tutu"]

.values()

Return the list of all 1st-level-property values in the target object.

object.values() => Array[String]

// example
do val = { "toto": 1, "tutu": 2 }
do val.values() // [1, 2]

.remove(String)

Remove the given property from the target object.

object.remove("property") => void

// example
do val = { "toto": 1, "tutu": 2 }
do val.remove("toto") // { "tutu": 2 }

.length()

Return the number of 1st-level properties in the target object.

object.length() => Integer

// example
do val = { "toto": 1, "tutu": 2 }
do val.length() // 2

.assign(b)

Insert all elements of the parameter object into the target object.

do obj = {"a": 1}
do obj.assign({"b": 2})
say "{{obj}}" // {"a": 1, "b": 2}
PreviousArray methodsNextNumber methods

Last updated 3 years ago

Was this helpful?