Skip to content

Instantly share code, notes, and snippets.


owensd/stringbytes.swift Secret

Created May 19, 2017
What would you like to do?
let data = String.Encoding.utf8, allowLossyConversion: false)!
return try data.withUnsafeBytes { (ptr: UnsafePointer<UInt8>) -> JSValue in
let buffer = UnsafeBufferPointer(start: ptr, count: data.count)
let generator = ReplayableGenerator(buffer)
let value = try parse(generator)
try validateRemainingContent(generator)
return value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment